JDK-8040630 : Popup menus and tooltips flicker with previous popup contents when first shown
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 7u40,8,11,13,14,15
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • Submitted: 2013-10-04
  • Updated: 2020-06-10
  • Resolved: 2020-03-10
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 11 JDK 13 JDK 15
11.0.8-oracleFixed 13.0.4Fixed 15 b16Fixed
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Darwin richard-laptop-2.local 12.5.0 Darwin Kernel Version 12.5.0: Mon Jul 29 16:33:49 PDT 2013; root:xnu-2050.48.11~1/RELEASE_X86_64 x86_64

A DESCRIPTION OF THE PROBLEM :
When a JPopupMenu or tooltip is shown, it briefly displays the content of the last popup that was shown before the new content is painted. This is only noticeable when the contents of the popup takes a little while to paint.

This can be quite noticeable and ugly in real programs where menus get quite big.

REGRESSION.  Last worked in version 6u45

REGRESSION : Additional Information
java version "1.6.0_51"
Java(TM) SE Runtime Environment (build 1.6.0_51-b11-457-11M4509)
Java HotSpot(TM) 64-Bit Server VM (build 20.51-b01-457, mixed mode)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run the included example code
2. Click on "Button 1"
3. Click on "Button 2" and watch the popup menu closely

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
As soon as the "Button 2" popup is displayed it should show the new menu items.
ACTUAL -
For a fraction of a second the "Button 2" popup shows the contents of the "Button 1" popup.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
public static void main(String[] args) {
        JFrame f = new JFrame();
        final JButton button1 = new JButton();
        button1.setAction(new AbstractAction("Button 1") {
            @Override
            public void actionPerformed(ActionEvent e) {
                JPopupMenu m = new JPopupMenu();
                m.add(new JMenuItem("<html><b>#################</b></html>"));
                m.add(new JMenuItem("<html><b>#################</b></html>"));
                m.add(new JMenuItem("<html><b>#################</b></html>"));
                m.add(new JMenuItem("<html><b>#################</b></html>"));
                m.add(new JMenuItem("<html><b>#################</b></html>"));
                m.add(new JMenuItem("<html><b>#################</b></html>"));
                m.add(new JMenuItem("<html><b>#################</b></html>"));
                m.add(new JMenuItem("<html><b>#################</b></html>"));
                m.add(new JMenuItem("<html><b>#################</b></html>"));
                m.add(new JMenuItem("<html><b>#################</b></html>"));
                m.add(new JMenuItem("<html><b>#################</b></html>"));
                m.add(new JMenuItem("<html><b>#################</b></html>"));
                m.add(new JMenuItem("<html><b>#################</b></html>"));
                m.add(new JMenuItem("<html><b>#################</b></html>"));
                m.add(new JMenuItem("<html><b>#################</b></html>"));
                m.add(new JMenuItem("<html><b>#################</b></html>"));
                m.add(new JMenuItem("<html><b>#################</b></html>"));
                m.add(new JMenuItem("<html><b>#################</b></html>"));
                m.add(new JMenuItem("<html><b>#################</b></html>"));
                m.add(new JMenuItem("<html><b>#################</b></html>"));
                m.add(new JMenuItem("<html><b>#################</b></html>"));
                m.add(new JMenuItem("<html><b>#################</b></html>"));
                m.add(new JMenuItem("<html><b>#################</b></html>"));
                m.add(new JMenuItem("<html><b>#################</b></html>"));
                m.show(button1, 0, button1.getHeight());
            }
        });
        final JButton button2 = new JButton();
        button2.setAction(new AbstractAction("Button 2") {
            @Override
            public void actionPerformed(ActionEvent e) {
                JPopupMenu m = new JPopupMenu();
                m.add(new JMenuItem("<html><font color=gray>--------------</font></html>"));
                m.add(new JMenuItem("<html><font color=gray>--------------</font></html>"));
                m.add(new JMenuItem("<html><font color=gray>--------------</font></html>"));
                m.add(new JMenuItem("<html><font color=gray>--------------</font></html>"));
                m.add(new JMenuItem("<html><font color=gray>--------------</font></html>"));
                m.add(new JMenuItem("<html><font color=gray>--------------</font></html>"));
                m.add(new JMenuItem("<html><font color=gray>--------------</font></html>"));
                m.add(new JMenuItem("<html><font color=gray>--------------</font></html>"));
                m.add(new JMenuItem("<html><font color=gray>--------------</font></html>"));
                m.add(new JMenuItem("<html><font color=gray>--------------</font></html>"));
                m.add(new JMenuItem("<html><font color=gray>--------------</font></html>"));
                m.add(new JMenuItem("<html><font color=gray>--------------</font></html>"));
                m.add(new JMenuItem("<html><font color=gray>--------------</font></html>"));
                m.add(new JMenuItem("<html><font color=gray>--------------</font></html>"));
                m.add(new JMenuItem("<html><font color=gray>--------------</font></html>"));
                m.add(new JMenuItem("<html><font color=gray>--------------</font></html>"));
                m.add(new JMenuItem("<html><font color=gray>--------------</font></html>"));
                m.add(new JMenuItem("<html><font color=gray>--------------</font></html>"));
                m.add(new JMenuItem("<html><font color=gray>--------------</font></html>"));
                m.add(new JMenuItem("<html><font color=gray>--------------</font></html>"));
                m.add(new JMenuItem("<html><font color=gray>--------------</font></html>"));
                m.add(new JMenuItem("<html><font color=gray>--------------</font></html>"));
                m.add(new JMenuItem("<html><font color=gray>--------------</font></html>"));
                m.add(new JMenuItem("<html><font color=gray>--------------</font></html>"));
                m.show(button2, 0, button2.getHeight());
            }
        });
        JComponent c = Box.createHorizontalBox();
        c.add(button1);
        c.add(button2);
        f.setContentPane(c);
        f.pack();
        f.setVisible(true);
    }
---------- END SOURCE ----------
Comments
Fix request (13u) Requesting backport to 13u for parity with 11u, applies cleanly.
10-06-2020

Fix request (11u) -- will label after testing completed. I would like to downport this for parity with 11.0.8-oracle. Applies clean.
21-04-2020

URL: https://hg.openjdk.java.net/jdk/jdk/rev/2f6ba1720303 User: psadhukhan Date: 2020-03-22 11:49:29 +0000
22-03-2020

URL: https://hg.openjdk.java.net/jdk/client/rev/2f6ba1720303 User: serb Date: 2020-03-10 23:30:27 +0000
10-03-2020

- this is an issue reported against 7(7u), - there are now affected version 9 filed for this issue - 7u issues are transferred to Sustaining Nevertheless if someone have a report against 9 - please reopen and add affectedVersion 9 or 7u specific escalations might be reopen to Sustaining
10-08-2014

- this is an issue reported against 7(7u), - there are now affected version 9 filed for this issue - 7u issues are transferred to Sustaining Nevertheless if someone have a report against 9 - please reopen and add affectedVersion 9 or 7u specific escalations might be reopen to Sustaining
10-08-2014

The issue is reproducible with 9. This is not a regression as 7 is the first oracle JDK on OS X.
16-04-2014