views:

359

answers:

3

I have a Swing application and I'm trying to fade out the main application and show a window saying an operation is in progress (this is for long running operations that may need to block the UI). Is there an elegant way to do this in Swing (mainly the fading out the background) or maybe some swing library to help with this (maybe from swing labs)?

Thanks,

Jeff

+2  A: 

The latest version supports Transparent Windows. I don't use that version, but I would guess you can use a Timer to gradually change the opacity.

camickr
I believe that's what I'm looking for. Thanks.
Jeff Storey
A: 

Kirill Grouchnikov has some excellent articles on transparent and shaped windows (sorry, I'm not allowed to post proper hyperlinks yet):

  • www.pushing-pixels.org/?p=260
  • www.pushing-pixels.org/?p=277

I've successfully used Kirill's Trident animation and timeline library (kenai.com/projects/trident/pages/Home) to fade out a window, although you have to do a bit of mucking around to capture all the mouse enter/exit events since components displayed in the window will consume them otherwise.

Ash
A: 

You can use the glass pane for this, see

http://java.sun.com/docs/books/tutorial/uiswing/components/rootpane.html

MeBigFatGuy