JDK-6299213 : The PopupMenu is not updated if the LAF is changed (incomplete fix of 4962731)
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2005-07-20
  • Updated: 2011-03-08
  • Resolved: 2011-03-08
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
7 b10Fixed
Description
FULL PRODUCT VERSION :
java version "1.6.0-ea"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-ea-b43)
Java HotSpot(TM) Client VM (build 1.6.0-ea-b43, mixed mode, sharing)

A DESCRIPTION OF THE PROBLEM :
There is a bug 4962731, which are supposed to be fixed in Mustang, but it is not. Look at the code:

--- javax.swing.SwingUtilities
    private static void updateComponentTreeUI0(Component c) {
        if (c instanceof JComponent) {
            JComponent jc = (JComponent) c;
            jc.updateUI();
            JPopupMenu jpm =jc.getComponentPopupMenu();
            if(jpm != null && jpm.isVisible() && jpm.getInvoker() == jc) {
                updateComponentTreeUI(jpm);
            }
        }
...
---
This 'if' condition ('jpm.isVisible() && jpm.getInvoker() == jc') just doesn't work if popup menu is not displayed (which are normal condition if LAF is changed by main menu).



REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
override updateUI() and do manual update for component popup menu
###@###.### 2005-07-20 09:57:39 GMT

Comments
EVALUATION We can just remove isVisible and invoker checks peabody submitter providently added an additional check to protect from multiple updates, but actually it is a rather rare case to worry about
26-01-2007

EVALUATION Contribution forum : https://jdk-collaboration.dev.java.net/servlets/ProjectForumMessageView?forumID=1463&messageID=13419
08-06-2006