import javafx.application.Platform; import javafx.embed.swing.JFXPanel; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ComboBox; import javafx.scene.control.Tooltip; import javafx.scene.layout.HBox; import javax.swing.*; import javax.swing.SwingUtilities; import java.awt.event.*; import java.awt.*; /** * * * * @author diego.cirujano-cuesta * */ public class test extends JFrame { private static void initAndShowGUI() { JFrame frame = new JFrame("FX"); frame.setSize(300, 200); final JFXPanel fxPanel = new JFXPanel(); frame.add(fxPanel); JButton jb = new JButton("Swing button"); jb.addMouseMotionListener(new MouseMotionAdapter() { public void mouseMoved(MouseEvent e) { //System.err.println("JButton: x=" + e.getX() + " y=" + e.getY() + " scrX=" + e.getXOnScreen() + " scrY=" + e.getYOnScreen()); } }); jb.setToolTipText("JButton"); frame.add(jb, BorderLayout.NORTH); frame.setVisible(true); Platform.runLater(() -> { Button btn = new Button("Hola mundo"); btn.setTooltip(new Tooltip("hola mundo")); ComboBox box = new ComboBox(); HBox root = new HBox(btn, box); Scene scene = new Scene(root); fxPanel.setScene(scene); }); } public static void main(String[] args) { SwingUtilities.invokeLater(() -> { initAndShowGUI(); }); } }