use of javax.swing.AbstractAction in project JMRI by JMRI.
the class ControlPanelEditor method makeMarkerMenu.
protected void makeMarkerMenu() {
_markerMenu = new JMenu(Bundle.getMessage("MenuMarker"));
_menuBar.add(_markerMenu);
_markerMenu.add(new AbstractAction(Bundle.getMessage("AddLoco")) {
@Override
public void actionPerformed(ActionEvent e) {
locoMarkerFromInput();
}
});
_markerMenu.add(new AbstractAction(Bundle.getMessage("AddLocoRoster")) {
@Override
public void actionPerformed(ActionEvent e) {
locoMarkerFromRoster();
}
});
_markerMenu.add(new AbstractAction(Bundle.getMessage("RemoveMarkers")) {
@Override
public void actionPerformed(ActionEvent e) {
removeMarkers();
}
});
}
use of javax.swing.AbstractAction in project JMRI by JMRI.
the class TrackSegment method showBezierPopUp.
/**
* Display popup menu for information and editing.
*/
protected void showBezierPopUp(MouseEvent e, int hitPointType) {
int bezierControlPointIndex = hitPointType - BEZIER_CONTROL_POINT_OFFSET_MIN;
if (popup != null) {
popup.removeAll();
} else {
popup = new JPopupMenu();
}
JMenuItem jmi = popup.add(rb.getString("BezierControlPoint") + " #" + bezierControlPointIndex);
jmi.setEnabled(false);
popup.add(new JSeparator(JSeparator.HORIZONTAL));
if (bezierControlPoints.size() < BEZIER_CONTROL_POINT_OFFSET_MAX - BEZIER_CONTROL_POINT_OFFSET_MIN) {
popup.add(new AbstractAction(rb.getString("AddBezierControlPointAfter")) {
@Override
public void actionPerformed(ActionEvent e) {
addBezierControlPointAfter(bezierControlPointIndex);
}
});
popup.add(new AbstractAction(rb.getString("AddBezierControlPointBefore")) {
@Override
public void actionPerformed(ActionEvent e) {
addBezierControlPointBefore(bezierControlPointIndex);
}
});
}
if (bezierControlPoints.size() > 2) {
popup.add(new AbstractAction(rb.getString("DeleteBezierControlPoint") + " #" + bezierControlPointIndex) {
@Override
public void actionPerformed(ActionEvent e) {
deleteBezierControlPoint(bezierControlPointIndex);
}
});
}
popup.show(e.getComponent(), e.getX(), e.getY());
}
use of javax.swing.AbstractAction in project JMRI by JMRI.
the class PanelEditor method makeFrame.
/**
* Create sequence of panels, etc, for layout: JFrame contains its
* ContentPane which contains a JPanel with BoxLayout (p1) which contains a
* JScollPane (js) which contains the targetPane
*
*/
public JmriJFrame makeFrame(String name) {
JmriJFrame targetFrame = new JmriJFrame(name);
targetFrame.setVisible(false);
JMenuBar menuBar = new JMenuBar();
JMenu editMenu = new JMenu(Bundle.getMessage("MenuEdit"));
menuBar.add(editMenu);
editMenu.add(new AbstractAction(Bundle.getMessage("OpenEditor")) {
@Override
public void actionPerformed(ActionEvent e) {
setVisible(true);
}
});
editMenu.addSeparator();
editMenu.add(new AbstractAction(Bundle.getMessage("DeletePanel")) {
@Override
public void actionPerformed(ActionEvent e) {
if (deletePanel()) {
dispose(true);
}
}
});
targetFrame.setJMenuBar(menuBar);
// add maker menu
JMenu markerMenu = new JMenu(Bundle.getMessage("MenuMarker"));
menuBar.add(markerMenu);
markerMenu.add(new AbstractAction(Bundle.getMessage("AddLoco")) {
@Override
public void actionPerformed(ActionEvent e) {
locoMarkerFromInput();
}
});
markerMenu.add(new AbstractAction(Bundle.getMessage("AddLocoRoster")) {
@Override
public void actionPerformed(ActionEvent e) {
locoMarkerFromRoster();
}
});
markerMenu.add(new AbstractAction(Bundle.getMessage("RemoveMarkers")) {
@Override
public void actionPerformed(ActionEvent e) {
removeMarkers();
}
});
JMenu warrantMenu = jmri.jmrit.logix.WarrantTableAction.makeWarrantMenu(isEditable());
if (warrantMenu != null) {
menuBar.add(warrantMenu);
}
targetFrame.addHelpMenu("package.jmri.jmrit.display.PanelTarget", true);
return targetFrame;
}
use of javax.swing.AbstractAction in project JMRI by JMRI.
the class AppsLaunchFrame method editMenu.
protected void editMenu(JMenuBar menuBar, WindowInterface wi) {
JMenu editMenu = new JMenu(Bundle.getMessage("MenuEdit"));
menuBar.add(editMenu);
// cut, copy, paste
AbstractAction a;
a = new DefaultEditorKit.CutAction();
a.putValue(Action.NAME, Bundle.getMessage("MenuItemCut"));
editMenu.add(a);
a = new DefaultEditorKit.CopyAction();
a.putValue(Action.NAME, Bundle.getMessage("MenuItemCopy"));
editMenu.add(a);
a = new DefaultEditorKit.PasteAction();
a.putValue(Action.NAME, Bundle.getMessage("MenuItemPaste"));
editMenu.add(a);
// prefs
prefsAction = new apps.gui3.TabbedPreferencesAction(Bundle.getMessage("MenuItemPreferences"));
// Put prefs in Apple's prefered area on Mac OS X
if (SystemType.isMacOSX()) {
Application.getApplication().setPreferencesHandler(new PreferencesHandler() {
@Override
public void handlePreferences(EventObject eo) {
prefsAction.actionPerformed(null);
}
});
}
// Include prefs in Edit menu if not on Mac OS X or not using Aqua Look and Feel
if (!SystemType.isMacOSX() || !UIManager.getLookAndFeel().isNativeLookAndFeel()) {
editMenu.addSeparator();
editMenu.add(prefsAction);
}
}
use of javax.swing.AbstractAction in project JMRI by JMRI.
the class Apps method editMenu.
protected void editMenu(JMenuBar menuBar, WindowInterface wi) {
JMenu editMenu = new JMenu(Bundle.getMessage("MenuEdit"));
menuBar.add(editMenu);
// cut, copy, paste
AbstractAction a;
a = new DefaultEditorKit.CutAction();
a.putValue(Action.NAME, Bundle.getMessage("MenuItemCut"));
editMenu.add(a);
a = new DefaultEditorKit.CopyAction();
a.putValue(Action.NAME, Bundle.getMessage("MenuItemCopy"));
editMenu.add(a);
a = new DefaultEditorKit.PasteAction();
a.putValue(Action.NAME, Bundle.getMessage("MenuItemPaste"));
editMenu.add(a);
// prefs
prefsAction = new apps.gui3.TabbedPreferencesAction(Bundle.getMessage("MenuItemPreferences"));
// Put prefs in Apple's prefered area on Mac OS X
if (SystemType.isMacOSX()) {
Application.getApplication().setPreferencesHandler(new PreferencesHandler() {
@Override
public void handlePreferences(EventObject eo) {
doPreferences();
}
});
}
// Include prefs in Edit menu if not on Mac OS X or not using Aqua Look and Feel
if (!SystemType.isMacOSX() || !UIManager.getLookAndFeel().isNativeLookAndFeel()) {
editMenu.addSeparator();
editMenu.add(prefsAction);
}
}
Aggregations