File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Soft Skills this week in the Jobs Discussion 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: 42
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: 157
    
    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: 42
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...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cannot return to default stage syle