Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8033786

White flashing when opening Dialogs and Menus using Nimbus with dark background

    Details

    • Subcomponent:
    • Resolved In Build:
      b20
    • CPU:
      x86
    • OS:
      os_x

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "1.8.0-ea"
        Java(TM) SE Runtime Environment (build 1.8.0-ea-b121)
        Java HotSpot(TM) 64-Bit Server VM (build 25.0-b63, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Darwin Kernel Version 12.5.0: Sun Sep 29 13:33:47 PDT 2013; root:xnu-2050.48.12~1/RELEASE_X86_64 x86_64

        A DESCRIPTION OF THE PROBLEM :
        when opening JDialogs or JMenus with Nimbus Look & Feel and the L&F color changed so a dark background is used, JDialogs and JMenus are first painted white and then painted in their designated color, leading to an ugly "flashing" effect.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Use the test code given below and click on the button.


        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        JDialog and JMenu should immediately be painted in their designated color.
        ACTUAL -
        see description (white flashing)

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------

        import javax.swing.JButton;
        import javax.swing.JFrame;
        import javax.swing.JOptionPane;
        import javax.swing.UIDefaults;
        import javax.swing.UIManager;
        import javax.swing.UIManager.LookAndFeelInfo;
        import javax.swing.plaf.ColorUIResource;
        import java.awt.Color;
        import java.awt.event.ActionEvent;
        import java.awt.event.ActionListener;

        public class TestDarkNimbus {

            public static void main(String[] args) throws Exception {

                for(LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()){
                    if(info.getName().startsWith("Nimbus")){
                        System.out.println("Setting Look & Feel to " + info.getName());
                        UIManager.setLookAndFeel(info.getClassName());
                        break;
                    }
                }

                UIDefaults d = UIManager.getDefaults();
                d.put("control", new ColorUIResource(54, 54, 54));
                d.put("text", new ColorUIResource(214, 214, 214));
                d.put("nimbusBlueGrey", new ColorUIResource(44, 44, 44));
                d.put("nimbusBase", new ColorUIResource(54, 54, 54));
                d.put("nimbusFocus", new Color(71, 85, 101));
                d.put("nimbusLightBackground", new ColorUIResource(54, 54, 54));
                d.put("nimbusSelectionBackground", new ColorUIResource(51, 65, 81));
                d.put("nimbusSelection", new ColorUIResource(51, 65, 81));

                final JFrame frame = new JFrame(TestDarkNimbus.class.getSimpleName());
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                JButton button = new JButton("Test Dialog Flashing");
                button.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        JOptionPane.showMessageDialog(frame.getContentPane(), "Flash !!!!!!!!!!!!", "Flash demo",
                                JOptionPane.INFORMATION_MESSAGE);
                    }
                });
                frame.getContentPane().add(button);
                frame.pack();
                frame.setLocation(500, 500);
                frame.setVisible(true);
            }
        }

        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        none found so far

          Activity

          Hide
          serb Sergey Bylokhov added a comment -
          8-defer-request: not a regression and not a jck. Can be postponed to 8u20.
          Show
          serb Sergey Bylokhov added a comment - 8-defer-request: not a regression and not a jck. Can be postponed to 8u20.
          Hide
          maxelsso Mathias Axelsson (Inactive) added a comment -
          Release team: Approved for deferral.
          Show
          maxelsso Mathias Axelsson (Inactive) added a comment - Release team: Approved for deferral.
          Hide
          serb Sergey Bylokhov added a comment -
          Two problems here. There is a lag between the showing of the window and the first repaint action. We should change the color of the native window to the color of the Component(to the dark color in this case). The problem that JDialog does not set background color to the peer, like JFrame does.
          Show
          serb Sergey Bylokhov added a comment - Two problems here. There is a lag between the showing of the window and the first repaint action. We should change the color of the native window to the color of the Component(to the dark color in this case). The problem that JDialog does not set background color to the peer, like JFrame does.
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk8u/jdk8u-dev/jdk/rev/1270cec9be32
          User: serb
          Date: 2014-06-15 23:13:17 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk8u/jdk8u-dev/jdk/rev/1270cec9be32 User: serb Date: 2014-06-15 23:13:17 +0000
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/1270cec9be32
          User: lana
          Date: 2014-06-20 01:27:07 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/1270cec9be32 User: lana Date: 2014-06-20 01:27:07 +0000

            People

            • Assignee:
              serb Sergey Bylokhov
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: