
import javafx.application.Application;
import javafx.embed.swing.SwingNode;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import javax.swing.*;


public class NodeTest extends Application {

    private void addPanel(final SwingNode node) {

        JPanel panel = new JPanel();
        panel.setLayout(null);
        JButton b = new JButton("...");
        b.setLocation(100, 100);
        b.setSize(100, 100);
        panel.add(b);
        node.setContent(panel);
    }

    @Override
    public void start(Stage stage) throws Exception {

        SwingNode node = new SwingNode();

        SwingUtilities.invokeLater(() -> { addPanel(node); });

        StackPane pane = new StackPane();
        pane.getChildren().add(node);
        Scene scene = new Scene(pane, 300, 300);
        stage.setScene(scene);
        stage.setX(150);
        stage.setY(150);
        stage.show();
    }

    public static void main(String[] args) throws Exception { launch(args); }
}
