tags:

views:

1019

answers:

4
A: 

JFrame can not be made transparent as it is a heavyweight component. Only lightweight components such as JWindow can be made transparent.

objects
A: 

Since Java 1.3 there's a trick which allows to make partially transparent windows, or windows fading in (I usually use this for my splash screens), or special FX (such as shadows):

  • Before opening the window, programmatically take a screenshot of the region where your window is going to be (using java.awt.Robot.createScreenCapture())
  • Set the screenshot as the background of your root container (JPanel with custom paintComponent() routine)
  • Now you can add all kinds of transparent components, or paint another semitransparent image on top of the background.

Example which creates a window with a semitransparent shadow using this technique: http://www.eclipsezone.com/eclipse/forums/t17720.html

Peter Walser
this is doable this way, but i've found on some systems it can be really expensive. taking a screenshot of a giant multimonitor setup and redrawing it as your background can be really flickery, especially if the user can drag/move the window. for a splash or something that is immobile, it would work though.
John Gardner
A: 

Not much help to you but Java7 will support transparent and shaped windows: More info here. These are available already in Java 6u10 but not publicly, ie, you need to use an unsupported com.sun... class that might change in future and break your program.

banjollity