/** Creates a JRadioButtonMenuItem for the Look and Feel menu */ private JMenuItem createLafMenuItem( JMenu menu, String label, char mnemonic, String accessibleDescription, String laf) { JMenuItem mi = (JRadioButtonMenuItem) menu.add(new JRadioButtonMenuItem(label)); lafMenuGroup.add(mi); mi.setMnemonic(mnemonic); mi.getAccessibleContext().setAccessibleDescription(accessibleDescription); mi.addActionListener(new ChangeLookAndFeelAction(this, laf)); mi.setEnabled(isAvailableLookAndFeel(laf)); return mi; }
/** Creates a generic menu item */ protected JMenuItem createMenuItem( JMenu menu, String label, char mnemonic, String accessibleDescription, Action action) { JMenuItem mi = (JMenuItem) menu.add(new JMenuItem(label)); mi.setMnemonic(mnemonic); mi.getAccessibleContext().setAccessibleDescription(accessibleDescription); mi.addActionListener(action); if (action == null) { mi.setEnabled(false); } return mi; }