JDK-4394642 : JPopupMenu should implement isShowing() method
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.3.0,5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: solaris_7,windows_xp
  • CPU: x86,sparc
  • Submitted: 2000-12-04
  • Updated: 2007-02-01
  • Resolved: 2007-02-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7Resolved
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
We are working on GUI testing of Forte for Java by Jemmy (GUI testing tool, see http://techpubs.Eng.Sun.COM:80/net/ultrapuma/export/ultrapuma4/jemmypages/ if you are interested). We found out that there can exist JPopupMenu which has isShowing()==true, isVisible()==false, popup==null.
I think this is the state in which no component should stay because javadoc of Component.isShowing() says:

    /**
     * Determines whether this component is showing on screen. This means
     * that the component must be visible, and it must be in a container
     * that is visible and showing.
     */

I guess isShowing() method should be implemented in JPopupMenu class such way as isVisible() method, i.e.

    public boolean isShowing() {
        if(popup != null)
            return true;
        else
            return false;
    }
    
Then our tests will find the correct popup-menu.

Comments
EVALUATION Submitter didn't provide a test which shows how he creates a PopupMenu with isShowing()==true, isVisible()==false, popup==null. Status changed to not reproducible
26-01-2007

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
25-09-2004

EVALUATION Name: pzR10082 Date: 08/13/2001 The submitter's suggestion is quite reasonable, because isVisible() is redefined in JPopupMenu. java.awt.Component.isShowing() unfortunately doesn't call isVisible(), it checks value of package private variable 'visible' instead. So if we override isVisible() we should probably override isShowing() too. ###@###.### 2001-08-13 ======================================================================
13-08-2001

SUGGESTED FIX Name: pzR10082 Date: 08/13/2001 *** /tmp/geta5640 Mon Aug 13 13:28:05 2001 --- JPopupMenu.java Mon Aug 13 13:27:04 2001 *************** *** 753,758 **** --- 753,770 ---- } /** + * Returns true if the popup menu is showing on screen. This means + * that it is visible, and its parent container is visible and showing. + * @return <code>true</code> if the component is showing, + * <code>false</code> otherwise + * @see #setVisible + * @since 1.4 + */ + public boolean isShowing() { + return isVisible() && super.isShowing(); + } + + /** * Returns true if the popup menu is visible (currently * being displayed). */ ###@###.### 2001-08-13 ======================================================================
13-08-2001