Example usage for javax.swing JMenu isVisible

List of usage examples for javax.swing JMenu isVisible

Introduction

In this page you can find the example usage for javax.swing JMenu isVisible.

Prototype

@Transient
public boolean isVisible() 

Source Link

Document

Determines whether this component should be visible when its parent is visible.

Usage

From source file:processing.app.Base.java

private void filterVisibilityOfSubsequentBoardMenus(List<JMenu> boardsCustomMenus, TargetBoard board,
        int fromIndex) {
    for (int i = fromIndex; i < boardsCustomMenus.size(); i++) {
        JMenu menu = boardsCustomMenus.get(i);
        for (int m = 0; m < menu.getItemCount(); m++) {
            JMenuItem menuItem = menu.getItem(m);
            menuItem.setVisible(menuItem.getAction().getValue("board").equals(board));
        }//from w w  w .j  a  va  2s.  com
        menu.setVisible(ifThereAreVisibleItemsOn(menu));

        if (menu.isVisible()) {
            JMenuItem visibleSelectedOrFirstMenuItem = selectVisibleSelectedOrFirstMenuItem(menu);
            if (!visibleSelectedOrFirstMenuItem.isSelected()) {
                visibleSelectedOrFirstMenuItem.setSelected(true);
                visibleSelectedOrFirstMenuItem.getAction().actionPerformed(null);
            }
        }
    }
}