List of usage examples for javax.swing JMenu setMnemonic
@BeanProperty(visualUpdate = true, description = "the keyboard character mnemonic") public void setMnemonic(int mnemonic)
From source file:us.paulevans.basicxslt.BasicXSLTFrame.java
/** * Create the menubar.//www .jav a2 s .co m * */ private void buildMenuBar() { // local declarations... JMenuBar menuBar; JMenu help, file, validation, view; // build the file menu and associated menu items... file = new JMenu(stringFactory.getString(LabelStringFactory.MF_FILE_MENU)); file.setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_FILE_MENU)); resetForm = new JMenuItem(stringFactory.getString(LabelStringFactory.MF_FILE_RESET_FORM_MI)); resetForm.setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_FILE_RESET_FORM_MI)); resetForm.addActionListener(this); file.add(resetForm); file.add(new JSeparator()); file.add(loadConfiguration = new JMenuItem( stringFactory.getString(LabelStringFactory.MF_FILE_LOAD_CONFIGURATION_MI))); loadConfiguration.setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_FILE_LOAD_CONFIGURATION_MI)); file.add(saveConfiguration = new JMenuItem( stringFactory.getString(LabelStringFactory.MF_FILE_SAVE_CONFIGURATION_MI))); saveConfiguration.setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_FILE_SAVE_CONFIGURATION_MI)); file.add(saveAsConfiguration = new JMenuItem( stringFactory.getString(LabelStringFactory.MF_FILE_SAVE_CONFIGURATION_AS_MI))); saveAsConfiguration .setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_FILE_SAVE_CONFIGURATION_AS_MI)); loadConfiguration.addActionListener(this); saveConfiguration.addActionListener(this); saveAsConfiguration.addActionListener(this); file.add(new JSeparator()); exit = new JMenuItem(stringFactory.getString(LabelStringFactory.MF_FILE_EXIT_MI)); exit.setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_FILE_EXIT_MI)); exit.addActionListener(this); file.add(exit); // build the validation menu and associated menu items... validation = new JMenu(stringFactory.getString(LabelStringFactory.MF_VALIDATION_MENU)); validation.setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_VALIDATION_MENU)); validation.add(checkSaxWarning = new JCheckBoxMenuItem( stringFactory.getString(LabelStringFactory.MF_VALIDATION_CHECK_SAX_WARNINGS_MI))); checkSaxWarning .setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_VALIDATION_CHECK_SAX_WARNINGS_MI)); validation.add(checkSaxError = new JCheckBoxMenuItem( stringFactory.getString(LabelStringFactory.MF_VALIDATION_CHECK_SAX_ERRORS_MI))); checkSaxError.setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_VALIDATION_CHECK_SAX_ERRORS_MI)); validation.add(checkSaxFatalError = new JCheckBoxMenuItem( stringFactory.getString(LabelStringFactory.MF_VALIDATION_CHECK_SAX_FATAL_MI))); checkSaxFatalError .setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_VALIDATION_CHECK_SAX_FATAL_MI)); // build the view menu and associate menu items... view = new JMenu(stringFactory.getString(LabelStringFactory.MF_VIEW_MENU)); view.setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_VIEW_MENU)); view.add(transformTimings = new JMenuItem( stringFactory.getString(LabelStringFactory.MF_VIEW_LAST_TIMINGS_MI))); transformTimings.setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_VIEW_LAST_TIMINGS_MI)); transformTimings.setEnabled(false); transformTimings.addActionListener(this); // build the help menu and associated menu items... help = new JMenu(stringFactory.getString(LabelStringFactory.MF_HELP_MENU)); help.setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_HELP_MENU)); about = new JMenuItem(stringFactory.getString(LabelStringFactory.MF_HELP_ABOUT_MI)); about.setMnemonic(stringFactory.getMnemonic(LabelStringFactory.MF_HELP_ABOUT_MI)); about.addActionListener(this); help.add(about); // build the menubar... menuBar = new JMenuBar(); menuBar.add(file); menuBar.add(validation); menuBar.add(view); menuBar.add(help); setJMenuBar(menuBar); }
From source file:us.paulevans.basicxslt.OutputFrame.java
/** * Builds the GUI menu bar./* w w w . ja v a 2 s . c o m*/ */ private void buildMenuBar() { JMenu file, view; JMenuBar menuBar; menuBar = new JMenuBar(); file = new JMenu(stringFactory.getString(LabelStringFactory.OF_FILE_MENU)); file.setMnemonic(stringFactory.getMnemonic(LabelStringFactory.OF_FILE_MENU)); close = new JMenuItem(stringFactory.getString(LabelStringFactory.OF_FILE_CLOSE_MI)); close.setMnemonic(stringFactory.getMnemonic(LabelStringFactory.OF_FILE_CLOSE_MI)); close.addActionListener(this); file.add(close); menuBar.add(file); if (xslRows != null) { view = new JMenu(stringFactory.getString(LabelStringFactory.OF_VIEW_MENU)); view.setMnemonic(stringFactory.getMnemonic(LabelStringFactory.OF_VIEW_MENU)); view.add(transformTimings = new JMenuItem( stringFactory.getString(LabelStringFactory.OF_VIEW_TRANSFORM_TIMINGS_DETAIL_MI))); transformTimings .setMnemonic(stringFactory.getMnemonic(LabelStringFactory.OF_VIEW_TRANSFORM_TIMINGS_DETAIL_MI)); transformTimings.addActionListener(this); menuBar.add(view); } setJMenuBar(menuBar); }