List of usage examples for javax.swing JCheckBoxMenuItem doClick
public void doClick()
From source file:ffx.ui.MainMenu.java
private JCheckBoxMenuItem addCBMenuItem(JMenu menu, String icon, String actionCommand, int mnemonic, int accelerator, final ActionListener actionListener) { final JCheckBoxMenuItem menuItem = new JCheckBoxMenuItem(); Action a = new AbstractAction() { @Override// w w w .ja v a2 s . c o m public void actionPerformed(ActionEvent e) { /** * If the ActionEvent is from a ToolBar button, pass it through * the JCheckBoxMenuItem. */ if (e.getSource() != menuItem) { menuItem.doClick(); return; } actionListener.actionPerformed(e); } }; configureAction(a, icon, actionCommand, mnemonic, accelerator); menuItem.setAction(a); menu.add(menuItem); return menuItem; }