Yes, this question is everywhere. But all (working) solutions use the AWTUtilities toolkit, which is limited.
So. I just want to control the opacity of my window. No need to shape or decompose. Just a transparent contentPane (simple) and a transparent JFrame background (ridiculously complicated).
I could have sworn I got the right combination yesterday, but now I can’t reproduce it. There are also some solutions that do not use AWTUtilities, but they do not work ... does anyone have a good solution?
Example of my failed code:
public static void main(String[] args) {
JFrame test = new JFrame();
test.setSize(400, 400);
test.setLocationRelativeTo(null);
test.setUndecorated(true);
test.setBackground(new Color(0, 0, 0, 0));
test.getContentPane().setBackground(new Color(0,0,0,0));
test.setVisible(true);
}
but it just makes a white square. Close, but not a cigar. I also tried overriding the drawing method, and someone was saying something about discarding the alpha channel, but that made it black (of course). So ... Qaru it.
, , , , .
, , :
, , - . , "... 75% - ". ... , , , . , .
, :
"" http://www.java-gaming.org/index.php?topic=24635.0, , .
http://techgearup.wordpress.com/2008/09/19/transparent-jframe-background/ , .