Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Cannot return to default stage syle

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Rancher
Posts: 387
30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic