I am trying to use SwingNode from JavaFX8 using this code. The problem is when the window appears. I canβt click the button until I resized the window. Moving does not work. I need to either maximize it or resize it with the mouse to make the button respond.
I understand that this may be a mistake, given that javafx8 is still in beta, but if it is not, do I need to do something to make this work without resizing the window in the first place?
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); } }
source share