wood burning stoves 2.0*
The moose likes JavaFX and the fly likes Cannot return to default stage syle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JavaFX
Bookmark "Cannot return to default stage syle" Watch "Cannot return to default stage syle" New topic
Author

Cannot return to default stage syle

Jc Frane
Ranch Hand

Joined: Aug 15, 2013
Posts: 32
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

Joined: Jan 26, 2012
Posts: 130
    
    9
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

Joined: Aug 15, 2013
Posts: 32
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...
 
Consider Paul's rocket mass heater.
 
subject: Cannot return to default stage syle
 
Similar Threads
How to set default font for JTextPane
JavaFX Using Multiple Stages with Netbeans JavaFX Designer
Need help with small problems
java:280: 'void' type not allowed here
Cannot Figure Out This Syntax Error