import java.awt.Dimension; import javax.swing.JFrame; import javafx.embed.swing.JFXPanel; import javafx.scene.control.ComboBox; import javafx.scene.Scene; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.application.Platform; import javax.swing.SwingUtilities; import javax.swing.JButton; import javax.swing.BoxLayout; import javax.swing.JOptionPane; import javax.swing.AbstractAction; import javax.swing.Action; import java.awt.event.ActionEvent; class JFXPanelTest extends JFrame { public static void main(final String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new JFXPanelTest(); } }); } JFXPanelTest() { final JFXPanel fxPanel = new JFXPanel(); // // initialize the scene in JavaFX thread. // Platform.runLater(new Runnable() { @Override public void run() { fxPanel.setScene(new Scene(new ComboBox(FXCollections.observableArrayList( "Option 1", "Option 2", "Option 3" )))); } }); Action showDialog = new AbstractAction("Show Dialog") { public void actionPerformed(ActionEvent e) { final JFXPanel fxPanel1 = new JFXPanel(); // // initialize the scene in JavaFX thread. // Platform.runLater(new Runnable() { @Override public void run() { fxPanel1.setScene(new Scene(new ComboBox(FXCollections.observableArrayList( "Option 1", "Option 2", "Option 3" )))); } }); fxPanel1.setPreferredSize(new Dimension(100, 25)); JOptionPane.showMessageDialog(JFXPanelTest.this, fxPanel1, "Select Item", JOptionPane.PLAIN_MESSAGE); } }; fxPanel.setPreferredSize(new Dimension(100, 25)); getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.PAGE_AXIS)); add(fxPanel); JButton showDialogButton = new JButton(); showDialogButton.setAction(showDialog); add(showDialogButton); pack(); setVisible(true); } };