Example #1
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();
   }
 }
Example #2
0
  public void initGui() {
    Addon spoutcraft = Spoutcraft.getAddonManager().getAddon("Spoutcraft");
    recordLabel = new GenericLabel("Key:");
    recordLabel.setAlign(WidgetAnchor.TOP_LEFT);
    recordLabel.setWidth(50).setHeight(20);
    recordLabel.setX(10).setY(40);
    getScreen().attachWidget(spoutcraft, recordLabel);

    recordButton = new GenericButton();
    recordButton.setAlign(WidgetAnchor.CENTER_CENTER);
    recordButton.setHeight(20).setWidth(100);
    recordButton.setX(44).setY(33);
    getScreen().attachWidget(spoutcraft, recordButton);
    updateRecordButton();

    titleLabel = new GenericLabel("Name:");
    titleLabel.setAlign(WidgetAnchor.TOP_LEFT);
    titleLabel.setWidth(50).setHeight(20);
    titleLabel.setX(10).setY(10);
    getScreen().attachWidget(spoutcraft, titleLabel);

    commandText = new GenericTextField();
    commandText.setHeight(16).setWidth(355);
    commandText.setX(45).setY(8);
    commandText.setText(item.getTitle());
    commandText.setFocus(true);
    commandText.setMaximumCharacters(99);
    getScreen().attachWidget(spoutcraft, commandText);

    slot = new GuiCommandsSlot(this);
    getScreen().attachWidget(spoutcraft, slot);

    doneButton = new GenericButton("Done");
    doneButton.setHeight(20).setWidth(50);
    doneButton.setX(10).setY(height - 30);
    getScreen().attachWidget(spoutcraft, doneButton);

    addButton = new GenericButton("Add Command");
    addButton.setHeight(20).setWidth(100);
    addButton.setX(70).setY(height - 30);
    getScreen().attachWidget(spoutcraft, addButton);

    editButton = new GenericButton("Edit Command");
    editButton.setHeight(20).setWidth(100);
    editButton.setX(180).setY(height - 30);
    getScreen().attachWidget(spoutcraft, editButton);

    removeButton = new GenericButton("Remove Command");
    removeButton.setHeight(20).setWidth(100);
    removeButton.setX(290).setY(height - 30);
    getScreen().attachWidget(spoutcraft, removeButton);

    updateButtons();
  }