java - Is it possible to close stage from other class method in javafx 2? -


is possible close stage other class method in javafx 2?

i developing little application stacked problem. want close loaded login fxml gui other class method(timerscheduler) after period of time. know weird close login stage after second have use of if possible. thank in advance!

here sample of code:

**main.java**  @override public void start(stage primarystage) throws ioexception {      // load stage fxml     anchorpane page = (anchorpane) fxmlloader.load(getclass().getresource("/fxml/fxmllogin.fxml"));     scene scene = new scene(page);     primarystage.setscene(scene);     primarystage.setresizable(false);     primarystage.settitle("admin login");     primarystage.show();      // run timer execute task     timer timer = new timer();     timerscheduler dotask = new timerscheduler(timer);     int firstsart = 1000;     int period = 1000;     timer.schedule(dotask,firstsart,period); }   **timerscheduler.java**  public class timerscheduler extends timertask{      timer timer;     int count = 0;      public timerscheduler(){}      public timerscheduler(timer timer){         this.timer=timer;     }      @override     public void run() {         count++;          if(count==30){ // execute after 30 seconds             // want close stage here         }     }      } 

sure pass stage , call stage.hide() - because not in fx-thread need wrap call platform.runlater()


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -