Is The Java Tutorials Translucent Window example giving trouble to those playing with jdk7?

Right from the JavaDocs for java.awt.frame.setOpacity() in JDK7:

The following conditions must be met in order to set the opacity value less than 1.0f:

  • The TRANSLUCENT translucency must be supported by the underlying system
  • The window must be undecorated (see setUndecorated(boolean) and Dialog.setUndecorated(boolean))
  • The window must not be in full-screen mode (see GraphicsDevice.setFullScreenWindow(Window))

If the requested opacity value is less than 1.0f, and any of the above conditions are not met, the window opacity will not change, and the IllegalComponentStateException will be thrown.

The behavior that you are seeing is documented and is expected behavior.

Leave a Comment