[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-macosx-port-dev
Subject:    Odd behavior with transparent window getting shadow after toggling visibility
From:       AJ Gregory <ajgregory () gmail ! com>
Date:       2014-11-25 19:47:04
Message-ID: CADgN_Nqja1S10i4ShDMA_Am1t57xd1aeF3ik1E58MSgE5bWzbw () mail ! gmail ! com
[Download RAW message or body]

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?

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();
            }
        });
    }
}
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic