/** * Handles the four buttons. * * @param e action event */ public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if (I18N.get("GUI.ok").equals(cmd)) { save(true); // Should add commands dispose(); } else if (I18N.get("GUI.apply").equals(cmd)) { save(false); // Should add commands } else if (I18N.get("GUI.revert").equals(cmd)) { revert(); } else if (I18N.get("GUI.cancel").equals(cmd)) { revert(); dispose(); } }
/** * Builds and returns a panel containing the bottom four buttons. * * @return the four buttons OK, Apply, Revert, and Cancel */ protected JPanel closeButtonPanel() { JPanel buttonPanel = new JPanel(); JButton button; buttonPanel.add(button = new JButton(I18N.get("GUI.ok"))); button.addActionListener(this); button.setDefaultCapable(true); buttonPanel.add(button = new JButton(I18N.get("GUI.apply"))); button.addActionListener(this); buttonPanel.add(revertButton = new JButton(I18N.get("GUI.revert"))); revertButton.addActionListener(this); revertButton.setEnabled(false); buttonPanel.add(button = new JButton(I18N.get("GUI.cancel"))); button.addActionListener(this); return buttonPanel; }
/** * Constructor. * * @param designer the window to which this dialog belongs * @param title window title * @param commandNameKey the {@link jimm.util.I18N} lookup key for the command name * @param modal passed on to superclass */ public EditWin(Designer designer, String title, String commandNameKey, boolean modal) { super(designer.getFrame(), title, modal); this.designer = designer; commands = new CompoundCommand(I18N.get(commandNameKey)); }