I have been trying the SwingNode from JavaFX8 using this code. The problem is when the window appears I can not click the button, until I have resized the window. Moving it does not work. I need to either maximize it or resize it with the mouse to get the button to respond.
I realize this could be a bug given that javafx8 is still in beta, but if thats not the case is there something I need to do to make this work with out resizing the window first?
public class SwingNodeTest extends Application {
private SwingNode swingNode;
@Override
public void start(Stage stage) {
swingNode = new SwingNode();
createAndSetSwingContent();
StackPane pane = new StackPane();
pane.getChildren().add(swingNode);
stage.setScene(new Scene(pane, 100, 50));
stage.show();
}
private void createAndSetSwingContent() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
swingNode.setContent(new JButton("Click me!"));
}
});
}
public static void main(String[] args) {
Application.launch(args);
}
}