Search in sources :

Example 1 with PreferencesHandler

use of jmri.plaf.macosx.PreferencesHandler 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);
    }
}
Also used : DefaultEditorKit(javax.swing.text.DefaultEditorKit) PreferencesHandler(jmri.plaf.macosx.PreferencesHandler) AbstractAction(javax.swing.AbstractAction) JMenu(javax.swing.JMenu) EventObject(java.util.EventObject)

Example 2 with PreferencesHandler

use of jmri.plaf.macosx.PreferencesHandler 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);
    }
}
Also used : DefaultEditorKit(javax.swing.text.DefaultEditorKit) PreferencesHandler(jmri.plaf.macosx.PreferencesHandler) AbstractAction(javax.swing.AbstractAction) JMenu(javax.swing.JMenu) EventObject(java.util.EventObject)

Example 3 with PreferencesHandler

use of jmri.plaf.macosx.PreferencesHandler in project JMRI by JMRI.

the class Apps3 method initMacOSXMenus.

protected void initMacOSXMenus() {
    jmri.plaf.macosx.Application macApp = jmri.plaf.macosx.Application.getApplication();
    macApp.setAboutHandler(new AboutHandler() {

        @Override
        public void handleAbout(EventObject eo) {
            new AboutDialog(null, true).setVisible(true);
        }
    });
    macApp.setPreferencesHandler(new PreferencesHandler() {

        @Override
        public void handlePreferences(EventObject eo) {
            new TabbedPreferencesAction(Bundle.getMessage("MenuItemPreferences")).actionPerformed();
        }
    });
    macApp.setQuitHandler(new QuitHandler() {

        @Override
        public boolean handleQuitRequest(EventObject eo) {
            return handleQuit();
        }
    });
}
Also used : QuitHandler(jmri.plaf.macosx.QuitHandler) AboutDialog(jmri.swing.AboutDialog) PreferencesHandler(jmri.plaf.macosx.PreferencesHandler) EventObject(java.util.EventObject) AboutHandler(jmri.plaf.macosx.AboutHandler)

Aggregations

EventObject (java.util.EventObject)3 PreferencesHandler (jmri.plaf.macosx.PreferencesHandler)3 AbstractAction (javax.swing.AbstractAction)2 JMenu (javax.swing.JMenu)2 DefaultEditorKit (javax.swing.text.DefaultEditorKit)2 AboutHandler (jmri.plaf.macosx.AboutHandler)1 QuitHandler (jmri.plaf.macosx.QuitHandler)1 AboutDialog (jmri.swing.AboutDialog)1