/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package bugs; import java.awt.BorderLayout; import java.awt.Dimension; import javax.swing.JFrame; import javax.swing.SwingUtilities; import javafx.application.Platform; import javafx.embed.swing.JFXPanel; import javafx.scene.Scene; import javafx.scene.control.PasswordField; import javafx.scene.control.TextArea; import javafx.scene.control.TextField; import javafx.scene.layout.VBox; public class ContextMenuIssueSwing { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { initAndShowGUI(); } }); } public static void initAndShowGUI() { JFrame frame = new JFrame("Swing application"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Create JavaFX panel. final JFXPanel fxPanel = new JFXPanel(); fxPanel.setPreferredSize(new Dimension(550, 400)); frame.getContentPane().add(fxPanel, BorderLayout.CENTER); Platform.runLater(new Runnable () { public void run () { VBox group = new VBox(); /* * Create a JavaFX text nodes */ final TextField jfxtextfield = new TextField("TextField"); final PasswordField jfxpasswordfield = new PasswordField(); jfxpasswordfield.setText("Text"); final TextArea jfxtextarea = new TextArea("TextArea"); /* * Add conten as a child of the Group node */ group.getChildren().addAll(jfxtextfield, jfxpasswordfield, jfxtextarea); /* * Create the Scene instance and set the group node as root */ final Scene scene = new Scene(group, 300, 300); SwingUtilities.invokeLater(new Runnable() { public void run() { fxPanel.setScene(scene); } }); } }); // Show frame. frame.pack(); frame.setVisible(true); } }