I have a web browser in my JFrame and i think I can't get it to dispose it on exiting the application.
Here is my code that tries to accomplish that:
Platform.runLater(new Runnable() {
@Override
public void run() {
webBrowserEngine.getLoadWorker().cancel();
Platform.runLater(new Runnable() {
@Override
public void run() {
Platform.exit();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
getMainFrame().dispose(); // Is set to dispose on close
// SwingUtilities.invokeLater(new Runnable() {
// @Override
// public void run() {
// System.exit(0);
// }
// });
}
});
}
});
}
});
The window closes, but the java process stays and this line returns always false:
webBrowserEngine.getLoadWorker().cancel();