use of javax.swing.AbstractAction in project JMRI by JMRI.
the class LocoIcon method showPopUp.
/**
* Pop-up only if right click and not dragged
*/
@Override
public boolean showPopUp(JPopupMenu popup) {
if (_entry != null) {
popup.add(new AbstractAction("Throttle") {
@Override
public void actionPerformed(ActionEvent e) {
tf = jmri.jmrit.throttle.ThrottleFrameManager.instance().createThrottleFrame();
tf.getAddressPanel().setRosterEntry(_entry);
tf.toFront();
}
});
}
popup.add(makeLocoIconMenu());
if (isEditable()) {
getEditor().setShowAlignmentMenu(this, popup);
getEditor().setShowCoordinatesMenu(this, popup);
popup.add(makeDockingMenu());
popup.add(makeDockMenu());
getPopupUtility().setTextFontMenu(popup);
} else {
setRotateMenu(popup);
if (_entry == null) {
setTextEditMenu(popup);
}
popup.add(makeDockMenu());
getPopupUtility().setTextFontMenu(popup);
getEditor().setRemoveMenu(this, popup);
}
return true;
}
use of javax.swing.AbstractAction in project processdash by dtuma.
the class LOCDiffDialog method setupWindowKeyBindings.
private void setupWindowKeyBindings(JComponent c) {
InputMap inputMap = c.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "closeDialog");
c.getActionMap().put("closeDialog", new AbstractAction() {
public void actionPerformed(ActionEvent e) {
closeDialog();
}
});
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "doCount");
c.getActionMap().put("doCount", new AbstractAction() {
public void actionPerformed(ActionEvent e) {
doCount();
}
});
}
use of javax.swing.AbstractAction in project processdash by dtuma.
the class UserEditor method makeToolbar.
private Component makeToolbar(boolean editable) {
FilterHandler filterer = EventHandler.create(FilterHandler.class, this, "updateFilter");
BoxUtils toolbar = BoxUtils.hbox();
searchField = new JTextField(10);
searchField.getDocument().addDocumentListener(filterer);
toolbar.addItems(resources.getString("Find") + ":", 3, searchField, 20);
showInactiveCheckbox = new JCheckBox(resources.getString("Show_Inactive"));
showInactiveCheckbox.addActionListener(filterer);
if (isLegacyPdesMode()) {
showInactiveCheckbox.setSelected(true);
} else {
toolbar.addItem(showInactiveCheckbox);
}
toolbar.addItems(100, BoxUtils.GLUE);
if (editable) {
AbstractAction add = (//
PersonLookupDialog.isLookupServerConfigured() ? new AddPdesUserAction() : new AddPlainUserAction());
toolbar.addItems(5, new JButton(add));
}
toolbar.addItems(5, new JButton(new ViewAction()));
if (editable)
toolbar.addItems(5, new JButton(new DeleteAction()));
toolbar.addItem(new JOptionPaneTweaker.MakeResizable());
toolbar.addItem(new JOptionPaneTweaker.DisableKeys());
return toolbar;
}
use of javax.swing.AbstractAction in project processdash by dtuma.
the class MacGUIUtils method tweakTable.
public static void tweakTable(JTable table) {
if (isMacOSX()) {
table.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_META, KeyEvent.META_DOWN_MASK), "doNothing");
table.getActionMap().put("doNothing", new AbstractAction() {
public void actionPerformed(ActionEvent e) {
}
});
}
}
use of javax.swing.AbstractAction in project JMRI by JMRI.
the class PanelProPane method statusPanel.
@Override
protected JPanel statusPanel() {
JPanel j = new JPanel();
j.setLayout(new BoxLayout(j, BoxLayout.Y_AXIS));
j.add(super.statusPanel());
// Buttons
Action quit = new AbstractAction(Bundle.getMessage("MenuItemQuit")) {
@Override
public void actionPerformed(ActionEvent e) {
Apps.handleQuit();
}
};
JPanel p3 = new JPanel();
p3.setLayout(new java.awt.FlowLayout());
JButton h1 = new JButton(Bundle.getMessage("ButtonHelp"));
jmri.util.HelpUtil.addHelpToComponent(h1, "html.apps.PanelPro.PanelPro");
h1.setAlignmentX(JLabel.CENTER_ALIGNMENT);
p3.add(h1);
JButton q1 = new JButton(Bundle.getMessage("ButtonQuit"));
q1.addActionListener(quit);
q1.setAlignmentX(JLabel.CENTER_ALIGNMENT);
p3.add(q1);
j.add(p3);
return j;
}
Aggregations