Odd behavior with transparent window getting shadow after toggling visibility

Alexander Scherbatiy alexandr.scherbatiy at oracle.com
Fri Dec 5 08:01:02 UTC 2014


On 11/25/2014 10:47 PM, AJ Gregory wrote:
> 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 wondering if it's a retina
> only issue?

     I can reproduce it on non-retina OSX 10.10 and it is not reproduced 
on my retina OSX 10.9.
     It seems that the problem relates to the OSX 10.10.

     Could you file an issue on it: http://bugs.java.com

   Thanks,
   Alexandr.

>
> Same behavior for both Java 7u71 and 8u25...
>
> Anybody else experience this and have a work around?
>
> Seems like a bug for sure unless I'm missing something...
>
> 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();
>              }
>          });
>      }
> }



More information about the macosx-port-dev mailing list