Java 类java.awt.event.ComponentListener 实例源码

项目:iSeleda    文件:WindowUtils.java   
/**
 * Installs/resets a ComponentListener to resize the
 * given window to minWidth/Height if needed.
 *
 * @param window
 * @param minWidth
 * @param minHeight
 */
public static void setMinimumSizeManager(Window window, int minWidth,
                                         int minHeight) {
    ComponentListener[] listeners = window.getComponentListeners();
    ComponentListener listener = null;
    for (ComponentListener l : listeners) {
        if (l instanceof MinSizeComponentListener) {
            listener = l;
            break;
        }
    }
    if (listener == null) {
        window.addComponentListener(new MinSizeComponentListener(
                window, minWidth, minHeight));
    } else {
        ((MinSizeComponentListener) listener).resetSizes(minWidth,
                minHeight);
    }
}
项目:sc2gears    文件:GuiUtils.java   
/**
 * Creates and returns a scroll panel which wraps the specified view component.<br>
 * The returned scroll panel disables vertical scroll bar, and only displays the horizontal scroll bar when the view does not fit
 * into the size of the view port. When the view fits into the view port, the scroll pane will not claim the space of the scroll bar.
 * 
 * @param view               view to wrap in the scroll pane
 * @param parentToRevalidate parent to revalidate when the scroll pane decides to change its size
 * 
 * @return the created self managed scroll pane
 */
public static JScrollPane createSelfManagedScrollPane( final Component view, final JComponent parentToRevalidate ) {
    final JScrollPane scrollPane = new JScrollPane( view );

    scrollPane.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_NEVER );
    scrollPane.getHorizontalScrollBar().setPreferredSize( new Dimension( 0, 12 ) ); // Only want to restrict the height, width doesn't matter (it takes up whole width)
    scrollPane.getHorizontalScrollBar().setUnitIncrement( 10 );

    final ComponentListener scrollPaneComponentListener = new ComponentAdapter() {
        @Override
        public void componentResized( final ComponentEvent event ) {
            scrollPane.setHorizontalScrollBarPolicy( view.getWidth() < scrollPane.getWidth() ? JScrollPane.HORIZONTAL_SCROLLBAR_NEVER : JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS );
            scrollPane.setPreferredSize( null );
            scrollPane.setPreferredSize( new Dimension( 10, scrollPane.getPreferredSize().height ) );
            parentToRevalidate.revalidate();
        }
    };
    scrollPane.addComponentListener( scrollPaneComponentListener );

    return scrollPane;
}
项目:power-matchmaker    文件:MungePen.java   
/**
 * Removes all listeners associated with the given Component. This is useful when removing to to make sure
 * it does not stick around.
 */
public static void removeAllListeners(Component com) {
    for (FocusListener fl : com.getFocusListeners()) {
        com.removeFocusListener(fl);
    }

    for (MouseListener ml : com.getMouseListeners()) {
        com.removeMouseListener(ml);
    }

    for (MouseMotionListener mml : com.getMouseMotionListeners()) {
        com.removeMouseMotionListener(mml);
    }

    for (KeyListener kl : com.getKeyListeners()) {
        com.removeKeyListener(kl);
    }

    for (ComponentListener cl : com.getComponentListeners()) {
        com.removeComponentListener(cl);
    }
}
项目:aibench-project    文件:WindowUtils.java   
/**
 * Installs/resets a ComponentListener to resize the
 * given window to minWidth/Height if needed.
 *
 * @param window
 * @param minWidth
 * @param minHeight
 */
public static void setMinimumSizeManager(Window window, int minWidth,
                                         int minHeight) {
    ComponentListener[] listeners = window.getComponentListeners();
    ComponentListener listener = null;
    for (ComponentListener l : listeners) {
        if (l instanceof MinSizeComponentListener) {
            listener = l;
            break;
        }
    }
    if (listener == null) {
        window.addComponentListener(new MinSizeComponentListener(
                window, minWidth, minHeight));
    } else {
        ((MinSizeComponentListener) listener).resetSizes(minWidth,
                                                         minHeight);
    }
}
项目:S3F    文件:MainUI.java   
public DockingWindow addView(int order, Configurable obj) {
    Component component = (Component) obj.getData().getProperty(TabProperty.COMPONENT);
    View view = new View(
            (String) obj.getData().getProperty(TabProperty.TITLE),
            (Icon) obj.getData().getProperty(TabProperty.ICON),
            component
    );

    if (component instanceof ComponentListener) {
        view.addComponentListener((ComponentListener) component);
    }

    if (order == 1 && obj instanceof DockingWindowListener) {
        DockingWindowListener dockingWindowListener = (DockingWindowListener) obj;
        view.addListener(dockingWindowListener);
        if (firstTabWindow.getChildWindowCount() == 0) {
            dockingWindowListener.windowShown(view);
        }
    }

    return addView(order, view);
}
项目:passage    文件:Layer.java   
/**
 * Fire a component event to the Layer component listeners, with the palette
 * as the component, letting them know if it's visible or not.
 */
public void firePaletteEvent(ComponentEvent event) {
    if (localHackList == null) {
        return;
    }

    palette = (Container) event.getSource();
    int eventType = event.getID();
    for (ComponentListener listener : localHackList) {
        if (eventType == ComponentEvent.COMPONENT_HIDDEN) {
            listener.componentHidden(event);
        } else if (eventType == ComponentEvent.COMPONENT_SHOWN) {
            listener.componentShown(event);
        }
    }

    if (eventType == ComponentEvent.COMPONENT_HIDDEN) {
        palette = null;
    }
}
项目:passage    文件:PaletteHelper.java   
/**
 * Get a layer's associated palette as a top-level window
 * 
 * @param gui the Component to place in the window
 * @param cl the listener to associate with the palette
 * @return the frame that the palette is in
 */
public static JFrame getPaletteWindow(Component gui, String windowName,
                                      ComponentListener cl) {

    JScrollPane scrollPane = new JScrollPane(gui, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);
    scrollPane.setAlignmentY(Component.TOP_ALIGNMENT);

    // create the palette internal window
    JFrame paletteWindow = new JFrame(windowName);

    paletteWindow.addComponentListener(cl);
    paletteWindow.getContentPane().add(scrollPane);
    //layout all the components
    paletteWindow.pack();
    return paletteWindow;
}
项目:passage    文件:PaletteHelper.java   
/**
 * Get a layer's associated palette as a top-level window
 * 
 * @param gui the Component to place in the window
 * @param cl the listener to associate with the palette
 * @return the frame that the palette is in
 */
public static JFrame getNoScrollPaletteWindow(Component gui,
                                              String windowName,
                                              ComponentListener cl) {

    JPanel pane = new JPanel();
    pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));
    pane.setAlignmentX(Component.CENTER_ALIGNMENT);
    pane.setAlignmentY(Component.BOTTOM_ALIGNMENT);
    pane.add(gui);
    JFrame paletteWindow = new JFrame(windowName);
    paletteWindow.addComponentListener(cl);
    paletteWindow.getContentPane().add(pane);
    paletteWindow.pack();

    return paletteWindow;
}
项目:passage    文件:WindowSupport.java   
/**
 * Sets the content in the JInternalFrame/JDialog.
 */
public void setContent(Component comp) {

    if (content instanceof ComponentListener) {
        removeComponentListener((ComponentListener) content);
    }

    content = comp;
    if (display != null) {
        display.setContent(comp);
    }

    if (content instanceof ComponentListener) {
        addComponentListener((ComponentListener) content);
    }
}
项目:cn1    文件:Component.java   
@SuppressWarnings("unchecked")
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
    if (ComponentListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getComponentListeners();
    } else if (FocusListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getFocusListeners();
    } else if (HierarchyBoundsListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getHierarchyBoundsListeners();
    } else if (HierarchyListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getHierarchyListeners();
    } else if (InputMethodListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getInputMethodListeners();
    } else if (KeyListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getKeyListeners();
    } else if (MouseWheelListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getMouseWheelListeners();
    } else if (MouseMotionListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getMouseMotionListeners();
    } else if (MouseListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getMouseListeners();
    } else if (PropertyChangeListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getPropertyChangeListeners();
    }
    return (T[]) Array.newInstance(listenerType, 0);
}
项目:cn1    文件:Component.java   
private void processComponentEventImpl(ComponentEvent e, Collection<ComponentListener> c) {
    for (ComponentListener listener : c) {
        switch (e.getID()) {
            case ComponentEvent.COMPONENT_HIDDEN:
                listener.componentHidden(e);
                break;
            case ComponentEvent.COMPONENT_MOVED:
                listener.componentMoved(e);
                break;
            case ComponentEvent.COMPONENT_RESIZED:
                listener.componentResized(e);
                break;
            case ComponentEvent.COMPONENT_SHOWN:
                listener.componentShown(e);
                break;
        }
    }
}
项目:freemind_1.0.0_20140624_214725    文件:EditNodeTextField.java   
private void hideMe() {
    final JComponent parent = (JComponent) textfield.getParent();
    final Rectangle bounds = textfield.getBounds();
    textfield.removeFocusListener(textFieldListener);
    textfield.removeKeyListener((KeyListener) textFieldListener);
    textfield.removeMouseListener((MouseListener) textFieldListener);
    mFocusListener
            .removeComponentListener((ComponentListener) textFieldListener);
    // workaround for java bug
    // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7075600, see
    // FreeMindStarter
    parent.remove(textfield);
    parent.revalidate();
    parent.repaint(bounds);
    textFieldListener = null;
}
项目:desktopclient-java    文件:ComponentUtils.java   
private void showPopupPanel() {
    if (mPopup == null)
        mPopup = new ComponentUtils.ModalPopup(this);

    PopupPanel panel = this.getPanel().orElse(null);
    if (panel == null)
        return;

    mPopup.removeAll();
    panel.onShow();

    for (ComponentListener cl : panel.getComponentListeners())
        panel.removeComponentListener(cl);

    panel.addComponentListener(new ComponentAdapter() {
        @Override
        public void componentHidden(ComponentEvent e) {
            mPopup.close();
        }
    });
    mPopup.add(panel);
    mPopup.showPopup();
}
项目:freeVM    文件:Component.java   
@SuppressWarnings("unchecked")
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
    if (ComponentListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getComponentListeners();
    } else if (FocusListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getFocusListeners();
    } else if (HierarchyBoundsListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getHierarchyBoundsListeners();
    } else if (HierarchyListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getHierarchyListeners();
    } else if (InputMethodListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getInputMethodListeners();
    } else if (KeyListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getKeyListeners();
    } else if (MouseWheelListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getMouseWheelListeners();
    } else if (MouseMotionListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getMouseMotionListeners();
    } else if (MouseListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getMouseListeners();
    } else if (PropertyChangeListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getPropertyChangeListeners();
    }
    return (T[]) Array.newInstance(listenerType, 0);
}
项目:freeVM    文件:Component.java   
private void processComponentEventImpl(ComponentEvent e, Collection<ComponentListener> c) {
    for (ComponentListener listener : c) {
        switch (e.getID()) {
            case ComponentEvent.COMPONENT_HIDDEN:
                listener.componentHidden(e);
                break;
            case ComponentEvent.COMPONENT_MOVED:
                listener.componentMoved(e);
                break;
            case ComponentEvent.COMPONENT_RESIZED:
                listener.componentResized(e);
                break;
            case ComponentEvent.COMPONENT_SHOWN:
                listener.componentShown(e);
                break;
        }
    }
}
项目:freeVM    文件:Component.java   
@SuppressWarnings("unchecked")
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
    if (ComponentListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getComponentListeners();
    } else if (FocusListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getFocusListeners();
    } else if (HierarchyBoundsListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getHierarchyBoundsListeners();
    } else if (HierarchyListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getHierarchyListeners();
    } else if (InputMethodListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getInputMethodListeners();
    } else if (KeyListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getKeyListeners();
    } else if (MouseWheelListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getMouseWheelListeners();
    } else if (MouseMotionListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getMouseMotionListeners();
    } else if (MouseListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getMouseListeners();
    } else if (PropertyChangeListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getPropertyChangeListeners();
    }
    return (T[]) Array.newInstance(listenerType, 0);
}
项目:freeVM    文件:Component.java   
private void processComponentEventImpl(ComponentEvent e, Collection<ComponentListener> c) {
    for (ComponentListener listener : c) {
        switch (e.getID()) {
            case ComponentEvent.COMPONENT_HIDDEN:
                listener.componentHidden(e);
                break;
            case ComponentEvent.COMPONENT_MOVED:
                listener.componentMoved(e);
                break;
            case ComponentEvent.COMPONENT_RESIZED:
                listener.componentResized(e);
                break;
            case ComponentEvent.COMPONENT_SHOWN:
                listener.componentShown(e);
                break;
        }
    }
}
项目:freemind    文件:EditNodeTextField.java   
private void hideMe() {
    final JComponent parent = (JComponent) textfield.getParent();
    final Rectangle bounds = textfield.getBounds();
    textfield.removeFocusListener(textFieldListener);
    textfield.removeKeyListener((KeyListener) textFieldListener);
    textfield.removeMouseListener((MouseListener) textFieldListener);
    mFocusListener
            .removeComponentListener((ComponentListener) textFieldListener);
    // workaround for java bug
    // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7075600, see
    // FreeMindStarter
    parent.remove(textfield);
    parent.revalidate();
    parent.repaint(bounds);
    textFieldListener = null;
}
项目:incubator-netbeans    文件:Outline.java   
/** Create a component listener to handle size changes if the table model
 * is large-model */
private ComponentListener getComponentListener() {
    if (componentListener == null) {
        componentListener = new SizeManager();
    }
    return componentListener;
}
项目:incubator-netbeans    文件:FontAndColorsPanel.java   
@Override
public void removeNotify() {
    super.removeNotify();
    for (ComponentListener l : getComponentListeners()) {
        super.removeComponentListener(l);
    }
}
项目:etomica    文件:DisplayCanvas.java   
public void dispose() {
    ComponentListener[] listeners = getComponentListeners();
    for (int i=0; i<listeners.length; i++) {
        removeComponentListener(listeners[i]);
    }
    MouseListener[] mlisteners = getMouseListeners();
    for (int i=0; i<mlisteners.length; i++) {
        removeMouseListener(mlisteners[i]);
    }
    KeyListener[] klisteners = getKeyListeners();
    for (int i=0; i<klisteners.length; i++) {
        removeKeyListener(klisteners[i]);
    }
}
项目:openjdk-jdk10    文件:ComponentOperator.java   
/**
 * Maps {@code Component.addComponentListener(ComponentListener)}
 * through queue
 */
public void addComponentListener(final ComponentListener componentListener) {
    runMapping(new MapVoidAction("addComponentListener") {
        @Override
        public void map() {
            getSource().addComponentListener(componentListener);
        }
    });
}
项目:openjdk-jdk10    文件:ComponentOperator.java   
/**
 * Maps {@code Component.removeComponentListener(ComponentListener)}
 * through queue
 */
public void removeComponentListener(final ComponentListener componentListener) {
    runMapping(new MapVoidAction("removeComponentListener") {
        @Override
        public void map() {
            getSource().removeComponentListener(componentListener);
        }
    });
}
项目:openjdk9    文件:ComponentOperator.java   
/**
 * Maps {@code Component.addComponentListener(ComponentListener)}
 * through queue
 */
public void addComponentListener(final ComponentListener componentListener) {
    runMapping(new MapVoidAction("addComponentListener") {
        @Override
        public void map() {
            getSource().addComponentListener(componentListener);
        }
    });
}
项目:openjdk9    文件:ComponentOperator.java   
/**
 * Maps {@code Component.removeComponentListener(ComponentListener)}
 * through queue
 */
public void removeComponentListener(final ComponentListener componentListener) {
    runMapping(new MapVoidAction("removeComponentListener") {
        @Override
        public void map() {
            getSource().removeComponentListener(componentListener);
        }
    });
}
项目:j2se_for_android    文件:Component.java   
public void fireComponentResizedAdAPI(){
    final ComponentEvent event = new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED);

    final ComponentListener[] listeners = getComponentListeners();
    for (int i = 0; i < listeners.length; i++) {
        listeners[i].componentResized(event);
    }
}
项目:j2se_for_android    文件:Component.java   
public void fireComponentMovedAdAPI(){
    final ComponentEvent event = new ComponentEvent(this, ComponentEvent.COMPONENT_MOVED);

    final ComponentListener[] listeners = getComponentListeners();
    for (int i = 0; i < listeners.length; i++) {
        listeners[i].componentMoved(event);
    }
}
项目:j2se_for_android    文件:Component.java   
public void fireComponentShowAdAPI(){
    final ComponentEvent event = new ComponentEvent(this, ComponentEvent.COMPONENT_SHOWN);

    final ComponentListener[] listeners = getComponentListeners();
    for (int i = 0; i < listeners.length; i++) {
        listeners[i].componentShown(event);
    }
}
项目:j2se_for_android    文件:Component.java   
public void fireComponentHiddenAdAPI(){
    final ComponentEvent event = new ComponentEvent(this, ComponentEvent.COMPONENT_HIDDEN);

    final ComponentListener[] listeners = getComponentListeners();
    for (int i = 0; i < listeners.length; i++) {
        listeners[i].componentHidden(event);
    }
}
项目:javify    文件:Component.java   
/**
 * Deserializes this component. This regenerates all serializable listeners
 * which were registered originally.
 *
 * @param s the stream to read from
 * @throws ClassNotFoundException if deserialization fails
 * @throws IOException if the stream fails
 */
private void readObject(ObjectInputStream s)
  throws ClassNotFoundException, IOException
{
  s.defaultReadObject();
  String key = (String) s.readObject();
  while (key != null)
    {
      Object listener = s.readObject();
      if ("componentL".equals(key))
        addComponentListener((ComponentListener) listener);
      else if ("focusL".equals(key))
        addFocusListener((FocusListener) listener);
      else if ("keyL".equals(key))
        addKeyListener((KeyListener) listener);
      else if ("mouseL".equals(key))
        addMouseListener((MouseListener) listener);
      else if ("mouseMotionL".equals(key))
        addMouseMotionListener((MouseMotionListener) listener);
      else if ("inputMethodL".equals(key))
        addInputMethodListener((InputMethodListener) listener);
      else if ("hierarchyL".equals(key))
        addHierarchyListener((HierarchyListener) listener);
      else if ("hierarchyBoundsL".equals(key))
        addHierarchyBoundsListener((HierarchyBoundsListener) listener);
      else if ("mouseWheelL".equals(key))
        addMouseWheelListener((MouseWheelListener) listener);
      key = (String) s.readObject();
    }
}
项目:javify    文件:StandaloneAppletWindow.java   
/**
 * This method is called when the component is resized.
 *
 * @param event the <code>ComponentEvent</code> indicating the resize
 */
public void componentResized(ComponentEvent event)
{
  if (applet != null)
    {
      ComponentListener[] l = applet.getComponentListeners();
      for (int i = 0; i < l.length; i++)
        l[i].componentResized(event);
    }
}
项目:javify    文件:StandaloneAppletWindow.java   
/**
 * This method is called when the component is moved.
 *
 * @param event the <code>ComponentEvent</code> indicating the move
 */
public void componentMoved(ComponentEvent event)
{
  if (applet != null)
    {
      ComponentListener[] l = applet.getComponentListeners();
      for (int i = 0; i < l.length; i++)
        l[i].componentMoved(event);
    }
}
项目:javify    文件:StandaloneAppletWindow.java   
/**
 * This method is called when the component is made visible.
 *
 * @param event the <code>ComponentEvent</code> indicating the visibility
 */
public void componentShown(ComponentEvent event)
{
  if (applet != null)
    {
      ComponentListener[] l = applet.getComponentListeners();
      for (int i = 0; i < l.length; i++)
        l[i].componentShown(event);
    }
}
项目:javify    文件:StandaloneAppletWindow.java   
/**
 * This method is called when the component is hidden.
 *
 * @param event the <code>ComponentEvent</code> indicating the visibility
 */
public void componentHidden(ComponentEvent event)
{
  if (applet != null)
    {
      ComponentListener[] l = applet.getComponentListeners();
      for (int i = 0; i < l.length; i++)
        l[i].componentHidden(event);
    }
}
项目:javify    文件:PluginAppletWindow.java   
/**
 * This method is called when the component is resized.
 *
 * @param event the <code>ComponentEvent</code> indicating the resize
 */
public void componentResized(ComponentEvent event)
{
  if (applet != null)
    {
      ComponentListener[] l = applet.getComponentListeners();
      for (int i = 0; i < l.length; i++)
        l[i].componentResized(event);
    }
}
项目:javify    文件:PluginAppletWindow.java   
/**
 * This method is called when the component is moved.
 *
 * @param event the <code>ComponentEvent</code> indicating the move
 */
public void componentMoved(ComponentEvent event)
{
  if (applet != null)
    {
      ComponentListener[] l = applet.getComponentListeners();
      for (int i = 0; i < l.length; i++)
        l[i].componentMoved(event);
    }
}
项目:javify    文件:PluginAppletWindow.java   
/**
 * This method is called when the component is made visible.
 *
 * @param event the <code>ComponentEvent</code> indicating the visibility
 */
public void componentShown(ComponentEvent event)
{
  if (applet != null)
    {
      ComponentListener[] l = applet.getComponentListeners();
      for (int i = 0; i < l.length; i++)
        l[i].componentShown(event);
    }
}
项目:javify    文件:PluginAppletWindow.java   
/**
 * This method is called when the component is hidden.
 *
 * @param event the <code>ComponentEvent</code> indicating the visibility
 */
public void componentHidden(ComponentEvent event)
{
  if (applet != null)
    {
      ComponentListener[] l = applet.getComponentListeners();
      for (int i = 0; i < l.length; i++)
        l[i].componentHidden(event);
    }
}
项目:intellij-ce-playground    文件:FrameState.java   
private static FrameState findFrameState(@NotNull Component component) {
  for (ComponentListener listener : component.getComponentListeners()) {
    if (listener instanceof FrameState) {
      return (FrameState)listener;
    }
  }
  return null;
}
项目:sqlpower-library    文件:PopupListenerHandler.java   
/**
* Returns true if the {@link Popup} this class handles is visible. Since
* there is no available method in the {@link Popup} class to check whether
* it is visible, it checks if listeners are attached to the owning frame or
* glass pane instead.
*/
  public boolean isPopupVisible() {
    ComponentListener[] componentListeners = owningFrame.getComponentListeners();
    if (Arrays.asList(componentListeners).contains(resizeListener)) {
        return true;
    }

    MouseListener[] mouseListeners = glassPane.getMouseListeners();
    if (Arrays.asList(mouseListeners).contains(clickListener)) {
        return true;
    }

    return false;

  }