List of usage examples for javax.swing JMenuItem setDisabledIcon
@BeanProperty(visualUpdate = true, description = "The disabled icon for the button.") public void setDisabledIcon(Icon disabledIcon)
From source file:net.sf.jabref.gui.JabRefFrame.java
/** * Creates icons for the disabled state for all JMenuItems with FontBasedIcons in the given menuElement. * This is necessary as Swing is not able to generate default disabled icons for font based icons. * * @param menuElement the menuElement for which disabled icons should be generated *//* ww w. j av a 2 s . c om*/ public void createDisabledIconsForMenuEntries(MenuElement menuElement) { for (MenuElement subElement : menuElement.getSubElements()) { if ((subElement instanceof JMenu) || (subElement instanceof JPopupMenu)) { createDisabledIconsForMenuEntries(subElement); } else if (subElement instanceof JMenuItem) { JMenuItem item = (JMenuItem) subElement; if (item.getIcon() instanceof IconTheme.FontBasedIcon) { item.setDisabledIcon(((IconTheme.FontBasedIcon) item.getIcon()).createDisabledIcon()); } } } }