0

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?

Joachim Sauer
  • 302,674
  • 57
  • 556
  • 614
Zakukashi
  • 566
  • 1
  • 13
  • 29

2 Answers2

3

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

Kumar Vivek Mitra
  • 33,294
  • 6
  • 48
  • 75
  • sorry thats not what Im looking for, this takes a snapshot of the region behind the window then displays an illusion within the jFrame. What I need is a special color that can cause the whole jframe to be transparent while undecorated. – Zakukashi Sep 18 '12 at 12:53
2

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.

mKorbel
  • 109,525
  • 20
  • 134
  • 319