JDK-8090517 : Be able to restart the JavaFX Application thread after it has exited
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: application-lifecycle
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2012-07-27
  • Updated: 2021-08-27
  • Resolved: 2021-08-27
Related Reports
Blocks :  
Duplicate :  
Relates :  
Description
Currently if you are embedding a JFXPanel in a Swing component and the Panel was closed, there is no way to reopen a new JFXPanel. This is due to the fact that when all windows are closed Platform.exit is called internally.
Comments
We do not plan to implement this. Applications can keep the JavaFX Runtime active by calling: Platform.setImplicitExit(false);
27-08-2021

We're using this in an embedded SWT application. In this usage, you will frequently be disposing the "last" panel within a running Java instance, so from our perspective anyway it seems like a wide assumption that closing the panel indicates that the application itself is closing, even if this seems natural for stand-alone Java apps. Diagnosing the issue is made more difficult because the only clue you get is the following exception: java.lang.IllegalStateException: Not on FX application thread; currentThread = JavaFX Application Thread at com.sun.javafx.tk.Toolkit.checkFxUserThread(Toolkit.java:210) Which seems to be saying that the thread that the application is expecting is not the thread that the application was expecting. ;) So perhaps a better exception message would be helpful, something like "The JavaFx Application thread has been disposed"..
05-12-2013

This feature will require changes in the Application life-cycle model to implement, and is unplanned for the upcoming 3.0 version. Note that you can disable implicit "exit on last window closed" behavior by calling Platform.setImplicitExit(false). Doing so will keep the JavaFX thread alive until you explicitly call Platform.exit().
27-07-2012