Example usage for javax.swing JPopupMenu isVisible

List of usage examples for javax.swing JPopupMenu isVisible

Introduction

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

Prototype

public boolean isVisible() 

Source Link

Document

Returns true if the popup menu is visible (currently being displayed).

Usage

From source file:Main.java

/**
 * Repaints UI tree recursively.//  ww  w .  j  ava  2s .  c  om
 *
 * @param c UI component.
 */
private static void updateComponentTreeUI0(Component c) {
    if (c instanceof JComponent) {
        JComponent jc = (JComponent) c;
        jc.invalidate();
        jc.validate();
        jc.repaint();
        JPopupMenu jpm = jc.getComponentPopupMenu();
        if (jpm != null && jpm.isVisible() && jpm.getInvoker() == jc) {
            updateComponentTreeUI(jpm);
        }
    }
    Component[] children = null;
    if (c instanceof JMenu) {
        children = ((JMenu) c).getMenuComponents();
    } else if (c instanceof java.awt.Container) {
        children = ((java.awt.Container) c).getComponents();
    }
    if (children != null) {
        for (int i = 0; i < children.length; i++)
            updateComponentTreeUI0(children[i]);
    }
}