List of usage examples for javax.swing JMenuItem isVisible
@Transient public boolean isVisible()
From source file:processing.app.Base.java
private static JMenuItem selectVisibleSelectedOrFirstMenuItem(JMenu menu) { JMenuItem firstVisible = null; for (int i = 0; i < menu.getItemCount(); i++) { JMenuItem item = menu.getItem(i); if (item != null && item.isVisible()) { if (item.isSelected()) { return item; }//from w w w .j av a2 s .c om if (firstVisible == null) { firstVisible = item; } } } if (firstVisible != null) { return firstVisible; } throw new IllegalStateException("Menu has no enabled items"); }