javafx.embed.singleThread=true not working
Hendrik Ebbers
hendrik.ebbers at me.com
Mon Feb 3 03:16:30 PST 2014
Hi,
I’m currently trying the experimental support of the javafx.embed.singleThread flag to mix the EDT and JFX Application Thread. Therefore I created a demo application. But when I start the app the following exception is thrown:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Not on FX application thread; currentThread = AWT-EventQueue-0
I think I’m doing something wrong but currently I have no idea why this is not working. Any ideas?
I’m using the folioing JavaFX version:
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b123)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b65, mixed mode)
Here is the code of the demo application:
public class JFXPanelDemo1 {
private static JButton swingButton;
private static Button jfxButton;
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
JFrame swingFrame = new JFrame("Integrate JavaFX in Swing");
swingFrame.getContentPane().setLayout(new BorderLayout());
swingButton = new JButton("I'm a Swing button");
swingFrame.getContentPane().add(BorderLayout.NORTH, swingButton);
swingButton.addActionListener((e) -> {
jfxButton.setDisable(!jfxButton.isDisable());
});
JFXPanel jfxPanel = new JFXPanel();
swingFrame.getContentPane().add(BorderLayout.CENTER, jfxPanel);
jfxButton = new Button("I'm a JavaFX button");
StackPane jfxPane = new StackPane(jfxButton);
Scene jfxScene = new Scene(jfxPane);
jfxPanel.setScene(jfxScene);
jfxButton.setOnAction((e) -> {
swingButton.setEnabled(!swingButton.isEnabled());
});
swingFrame.setVisible(true);
}
);
}
}
More information about the openjfx-dev
mailing list