List of usage examples for javax.swing JCheckBoxMenuItem setIcon
@BeanProperty(visualUpdate = true, description = "The button's default icon") public void setIcon(Icon defaultIcon)
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JCheckBoxMenuItem getIntelCheckBoxMenuItem(String text) { final JCheckBoxMenuItem box = new JCheckBoxMenuItem(text, UIImages.EMPTY_BOX_ICON.getImageIcon()); // should do it through L&F, but couldn't find the way to do it // so we are using action listener to dynamically change icon box.addActionListener(new ActionListener() { @Override/*from www.ja v a2s .com*/ public void actionPerformed(ActionEvent e) { box.setIcon(box.isSelected() ? UIImages.CHECK_BOX_ICON.getImageIcon() : UIImages.EMPTY_BOX_ICON.getImageIcon()); } }); return box; }