Reputation: 596
In JDK 1.7 I use setUndecorated(true);
and setBackground(new Color(0, 0, 0, 0));
to make my frame transparent.
This works perfectly but when I change the project to 1.6 this same code just makes the frame its original blue-ish color. I don't want to make my form Opacity lower as in alpha transparent. I want to have it more like a splash screen, where GD draws SOLID non opacity lines but the surrounding is completely click-through and transparent.
What is the code in 1.6 to do this?
Upvotes: 0
Views: 1213
Reputation: 33544
See this tutorial to understand how to make a JFrame Transparent
http://blogofjavacrazy.blogspot.in/2007/03/transparent-window-in-java.html
/////Edited Part//////
I stumbled upon a neat little hack that instead of actually being transparent, it takes a screenshot and adds that little segment as the background.
See this Link:
http://onjava.com/pub/a/onjava/excerpt/swinghks_hack41/index.html
Upvotes: 3
Reputation: 109823
In jdk 1.6 I use setUndecorated(true); setBackground(new Color(0, 0, 0, 0)); to make my frame transparent. This works perfectly but when I change the project to 1.6 this same code just makes the frame its original blue-ish color.
maybe there is this issue As of the Java Platform, Standard Edition 6 (Java SE 6) Update 10 release, you can add translucent and shaped windows to your Swing applications.
Upvotes: 2