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

[macosx] JWindow gets shadow from Mac OSX when you toggle visibility.

XMLWordPrintable

      FULL PRODUCT VERSION :
      Java 7u71

      ADDITIONAL OS VERSION INFORMATION :
      Mac OSX 10.10

      A DESCRIPTION OF THE PROBLEM :
      If you run the class below on a RETINA MacBook Pro (OSX 10.10) the first time you see the JWindow it's a white circle with NO shadow, but then later when it calls setVisible(false) and setVisible(true) the circle has a shadow when it's made visible again which isn't right...

      I can't reproduce on non-retina OSX 10.9 so could be either from retina or 10.10 OSX.

      Same behavior for both Java 7u71 and 8u25...

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the TestMacShadow test class included to reproduce.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      JWindow shouldn't have shadow from OS after it reappears.
      ACTUAL -
      JWindow has shadow from OS after it reappears.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;
      import java.awt.*;
      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;

      public class TestMacShadow {
          public static void main(String[] args) {
              EventQueue.invokeLater(new Runnable() {
                  public void run() {
                      final JWindow window = new JWindow() {
                          public void paint(Graphics g) {
                              g.setColor(Color.WHITE);
                              g.fillOval(0, 0, getWidth(), getHeight());
                          }
                      };

                      window.setBackground(new Color(0, 0, 0, 0));
                      window.setLocation(new Point(100, 100));
                      window.setSize(new Dimension(300, 300));
                      window.setAlwaysOnTop(true);
                      window.setVisible(true);

                      Timer t = new Timer(2000, new ActionListener() {
                          public void actionPerformed(ActionEvent actionEvent) {
                              window.setVisible(!window.isVisible());
                          }
                      });

                      t.setRepeats(true);
                      t.start();
                  }
              });
          }
      }
      ---------- END SOURCE ----------

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: