Skip to main content

JDK7 Frame Transparency prevents Animation in JLayeredPane

1 reply [Last post]
Joined: 2010-07-06

I am using JDK7 to create an analog gauge with an animated needle. It works properly using paintImmediately() to animate the needle. But I want the gauge to show without a frame and with a transparent background. So I set the frame undecorated and use frame.setBackground(new Color(0, 0, 0, 0)) for transparency and it displays perfectly. However with any alpha channel value other than 255 the animation fails. The paintImmediately() is suppressed. Is there anything I can do to fix this?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2006-07-24

The question actually belongs to the Swing & AWT forum [1].

Anyways, paintImmediately() may not work perfectly in transparent windows. Use the repaint() method instead.