Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot return to default stage syle

 
Jc Frane
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am having a problem on returning my stage to default style. I think that the default style is StageStyle.DECORATED.

Now, I set my stage's StageStyle to TRANSPARENT however, I want to return to its original style after a button click but I received exception saying:

Exception in runnable
java.lang.IllegalStateException: Cannot set style once stage has been set visible
at javafx.stage.Stage.initStyle(Stage.java:416)
at prototypepossystem.LogInFXMLController$1.handle(LogInFXMLController.java:105)
at prototypepossystem.LogInFXMLController$1.handle(LogInFXMLController.java:97)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:69)
.....


Can anyone help me figure out the problem?

Thank you so much!
 
John Damien Smith
Ranch Hand
Posts: 287
13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JavaFX error message already explains what is happening:

"Cannot set style once stage has been set visible"

What you need to do is create a new Stage, get the reference to the scene from the old stage, set the hide the existing stage

 
Jc Frane
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply...

I have another question, how about if I want to set the StageStyle from DECORATED to TRANSPARENT?

I try to do it my way, however, it ends up showing 3 stages...

Do you know how to implement this?

Thanks in advance...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic