Search in sources :

Example 1 with QuitHandler

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

the class Apps method createMenus.

/**
     * Create default menubar.
     * <P>
     * This does not include the development menu.
     *
     * @param menuBar Menu bar to be populated
     * @param wi      WindowInterface where this menu bar will appear
     */
protected void createMenus(JMenuBar menuBar, WindowInterface wi) {
    // the debugging statements in the following are
    // for testing startup time
    log.debug("start building menus");
    if (SystemType.isMacOSX()) {
        Application.getApplication().setQuitHandler(new QuitHandler() {

            @Override
            public boolean handleQuitRequest(EventObject eo) {
                return handleQuit();
            }
        });
    }
    fileMenu(menuBar, wi);
    editMenu(menuBar, wi);
    toolsMenu(menuBar, wi);
    rosterMenu(menuBar, wi);
    panelMenu(menuBar, wi);
    // check to see if operations in main menu
    if (jmri.jmrit.operations.setup.Setup.isMainMenuEnabled()) {
        operationsMenu(menuBar, wi);
    }
    systemsMenu(menuBar, wi);
    scriptMenu(menuBar, wi);
    debugMenu(menuBar, wi);
    // * GT 28-AUG-2008 Added window menu
    menuBar.add(new WindowMenu(wi));
    helpMenu(menuBar, wi);
    log.debug("end building menus");
}
Also used : QuitHandler(jmri.plaf.macosx.QuitHandler) WindowMenu(jmri.util.WindowMenu) EventObject(java.util.EventObject)

Example 2 with QuitHandler

use of jmri.plaf.macosx.QuitHandler 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)2 QuitHandler (jmri.plaf.macosx.QuitHandler)2 AboutHandler (jmri.plaf.macosx.AboutHandler)1 PreferencesHandler (jmri.plaf.macosx.PreferencesHandler)1 AboutDialog (jmri.swing.AboutDialog)1 WindowMenu (jmri.util.WindowMenu)1