Semi-transparent components?

Is it possible to control the transparency of a Swing component (by something like a percentage)?

If so, how? Googling didn't get me very far...

If not, I can just try taking a screenshot and replacing the old component with it and fading out that way, but doing this component side would sure be nicer.

I'm trying to give my program some eye candy and I thought a fade-out effect might be nice.

[422 byte] By [timothyb89_a] at [2007-11-27 7:53:16]
# 1

As far as I know - Not really! You can have a look at the "Swing hacks" book which gives you an example how to accomplish window transparency. if you want to add some "eye candy" the simple way, look for a nice look and feel library (I like substance and nimbus) or have a look at SwingX project at http://swinglabs.org/ for some hints.

Kris

kris_javaa at 2007-7-12 19:34:33 > top of Java-index,Desktop,Core GUI APIs...
# 2
For a JComponent you can just play with the background color. Read the Color API. You will need to use colors with an "alpha" value.
camickra at 2007-7-12 19:34:33 > top of Java-index,Desktop,Core GUI APIs...
# 3

> As far as I know - Not really! You can have a look at

> the "Swing hacks" book which gives you an example how

> to accomplish window transparency. if you want to add

> some "eye candy" the simple way, look for a nice look

> and feel library (I like substance and nimbus) or

> have a look at SwingX project at

> http://swinglabs.org/ for some hints.

> Kris

Thanks! The SwingX project is exactly what I'm looking for, plus some additional (unexpected) eye candy :)

I have to admit, the window theming and translucency is just what I need :)

timothyb89_a at 2007-7-12 19:34:33 > top of Java-index,Desktop,Core GUI APIs...