JDK-6725417 : Perpixel Transparent Windows broken on Vista with Aero - Still shows window decorations
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6u10
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_vista
  • CPU: generic
  • Submitted: 2008-07-14
  • Updated: 2011-02-23
  • Resolved: 2008-07-14
Related Reports
Duplicate :  
Description
If you run the test case at the bottom below on windows XP then you get single Button displayed on screen with no window background or decorations painted around it. If you do the same on Windows Vista you get the button with the window background transparent but the window decorations are still painted. The decorations are not live they can not be clicked on, the mouse events pass though to what ever is behind the window. This bug is only with the Aero window manager enabled.

I have found a almost workaround, it has the correct end result but has a nasty flicker/window zoom animation when you change from non-transparent to transparent window because thw window is being hidden and shown again. I have attached a full test app for the workaround.

// WORKAROUND

Point p = getLocation();
Insets i = getInsets();
setVisible(false);
dispose();
setUndecorated(jToggleButton1.isSelected());
setLocation(p.x, p.y+i.top);
AWTUtilities.setWindowOpaque(NewJFrame.this, !jToggleButton1.isSelected());
setVisible(true);

// TEST CASE

import com.sun.awt.AWTUtilities;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JFrame;

public class Main {

   public static void main(String args[]) {
       java.awt.EventQueue.invokeLater(new Runnable() {

           public void run() {
               JFrame frame = new JFrame("Test");
               AWTUtilities.setWindowOpaque(frame, false);
               JButton button = new JButton("Hello Everybody!");
               frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
               frame.getContentPane().setLayout(new FlowLayout());
               frame.add(button);
               frame.pack();
               frame.setSize(400,400);
               frame.setVisible(true);
           }
       });
   }
}

Comments
EVALUATION Dup of 6725365.
14-07-2008