package rt25772; import java.awt.Color; import javafx.application.Platform; import javafx.embed.swing.JFXPanel; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.BorderPane; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.SwingUtilities; /** * @author tav */ public class RT25772 { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { showGUI(); } }); } private static void showGUI() { final JFrame frame = new JFrame("frame"); final JFXPanel jfxp = new JFXPanel(); jfxp.setBorder(BorderFactory.createLineBorder(Color.RED, 4)); frame.add(jfxp); Platform.runLater(() -> { BorderPane pane = new BorderPane(); Button b = new Button("button"); b.setPrefSize(100, 100); pane.setCenter(b); Scene scene = new Scene(pane); jfxp.setScene(scene); SwingUtilities.invokeLater(() -> { frame.pack(); frame.setVisible(true); }); }); } }