Jeff Storey
Jeff Storey

Reputation: 57222

Java Swing Fade Out Background

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

Upvotes: 2

Views: 2051

Answers (3)

Ash
Ash

Reputation: 9446

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.

Upvotes: 0

MeBigFatGuy
MeBigFatGuy

Reputation: 28623

You can use the glass pane for this, see

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

Upvotes: 0

camickr
camickr

Reputation: 324207

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.

Upvotes: 2

Related Questions