The following page:
http://docs.oracle.com/javafx/2/ui_controls/file-chooser.htm
contains a sample application that calls AWT APIs on the FX Application Thread. Specifically, the Desktop.open() method is called from an action event handler. This threading pattern is wrong and shouldn't be advertised because it causes the application to freeze on certain platforms (e.g. seeRT-31468).
The correct pattern is to wrap the call to any AWT APIs in a runnable and submit it for execution via java.awt.EventQueue.invokeLater():
void fxEventHandler() {
EQ.invokeLater(() -> {
Desktop.open(...);
});
}
http://docs.oracle.com/javafx/2/ui_controls/file-chooser.htm
contains a sample application that calls AWT APIs on the FX Application Thread. Specifically, the Desktop.open() method is called from an action event handler. This threading pattern is wrong and shouldn't be advertised because it causes the application to freeze on certain platforms (e.g. see
The correct pattern is to wrap the call to any AWT APIs in a runnable and submit it for execution via java.awt.EventQueue.invokeLater():
void fxEventHandler() {
EQ.invokeLater(() -> {
Desktop.open(...);
});
}