protected void buttonClicked(Button btn) { if (btn.equals(recordButton)) { recording = !recording; updateRecordButton(); } if (btn.equals(doneButton)) { item.setTitle(commandText.getText()); if (!item.getTitle().equals("") && item.getKey() != -1) { SimpleKeyBindingManager manager = (SimpleKeyBindingManager) SpoutClient.getInstance().getKeyBindingManager(); manager.unregisterShortcut(item); manager.registerShortcut(item); } mc.displayGuiScreen(parent); parent.getModel().refresh(); } if (btn.equals(addButton)) { editCommand(-1); } if (btn.equals(editButton)) { editCommand(slot.getSelectedRow()); } if (btn.equals(removeButton)) { item.removeCommand(slot.getSelectedRow()); slot.updateItems(); updateButtons(); } }
private void updateRecordButton() { String keyname = recording ? "Press a key!" : "Click Here!"; if (item.getKey() >= 0 && !recording) { keyname = item.toString(); } String name = (recording ? "> " : "") + keyname + (recording ? " <" : ""); recordButton.setText(name); }