0

I have two JFrames and when the first one is clicked it opens up the second one based on where the mouse was pressed and released. They both are undecorated and it works fine when I have the opacity set as

setOpacity(0.3f);

In the first frame and when it's clicked the opacity of the second one is

setOpacity(1.0f);

But when I change the opacity of the second frame to anything under 1.0 I get the following error.

Exception in thread "AWT-EventQueue-0" java.awt.IllegalComponentStateException: The frame is decorated at java.awt.Frame.setOpacity(Unknown Source) at FrontWindow.(FrontWindow.java:26) at BackWindow$3.mouseReleased(BackWindow.java:58) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$200(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)

Does anyone know what the error is and how I can make the opacity of the second frame less than 1.0? Thanks in advance.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Maple
  • 17
  • 6
  • [please to see and read carefully](http://stackoverflow.com/questions/16219111/cant-transparent-and-undecorated-jframe-in-jdk7-when-enabling-nimbus), to [check for final workaround](http://stackoverflow.com/a/16699136/714968) – mKorbel Jun 24 '13 at 16:38
  • Turns out the opacity had to be set under setUndecorated(true); – Maple Jun 24 '13 at 20:26

0 Answers0