@Override public void initGui() { obsidiFile = new File(System.getProperty("user.dir") + "/ObsidiCode/Test/SimpleMiner.oc"); this.buttonList.add( new GuiButton( saveButton, this.width / 2 + 5, this.height / 2 + 125, 100, 20, "Save and Exit")); this.buttonList.add( new GuiButton(resetButton, this.width / 2 - 105, this.height / 2 + 125, 100, 20, "Reset")); loadFile(); if (!text.toString().contains("_") && text.toString().equals("")) text.append(cursor); cursorLocation = text.length() - 1; super.initGui(); }
/* returns true if deletion is allowed */ private boolean isAllowedDeletion() { if ((org.lwjgl.input.Keyboard.getEventKey() == org.lwjgl.input.Keyboard.KEY_BACK) && (text.length() > 1) && (cursorLocation > 0)) return true; else return false; }
/* returns true if the users right arrow navigation is allowed */ private boolean isAllowedRightArrowNavigation() { if (org.lwjgl.input.Keyboard.getEventKey() == org.lwjgl.input.Keyboard.KEY_RIGHT && cursorLocation < text.length() - 1) return true; else return false; }