コード例 #1
0
ファイル: GuiControls.java プロジェクト: rezzanate/Spoutcraft
  @Override
  protected void buttonClicked(Button btn) {
    if (btn.equals(buttonDone)) {
      mc.displayGuiScreen(parentScreen);
      return;
    }

    if (btn.equals(buttonAdd)) {
      Shortcut sh = new Shortcut();
      sh.setTitle("");
      sh.setKey(Keyboard.KEY_UNKNOWN.getKeyCode());
      editItem(sh);
      return;
    }
    ControlsBasicItem item = model.getItem(view.getSelectedRow());
    ShortcutBindingItem sh = null;
    if (item != null && item instanceof ShortcutBindingItem) {
      sh = (ShortcutBindingItem) item;
    }
    if (sh != null && btn.equals(buttonEdit)) {
      editItem(sh.getShortcut());
    } else if (btn.equals(buttonEdit) && item != null) {
      model.setEditing(item);
    }
  }
コード例 #2
0
 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();
   }
 }
コード例 #3
0
 public void editCommand(int i) {
   item.setTitle(commandText.getText());
   GuiEditCommand gui = new GuiEditCommand(this, i);
   mc.displayGuiScreen(gui);
 }