package swingbrowser; import java.awt.BorderLayout; import java.awt.Dimension; import javafx.application.Application; import javafx.embed.swing.JFXPanel; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.VBox; import javafx.scene.web.WebEngine; import javafx.scene.web.WebView; import javafx.stage.Stage; import javax.swing.JFrame; import javax.swing.SwingUtilities; public class SwingBrowser extends Application { private static JFXPanel jfxPanel; private static WebEngine webEngine; public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { JFrame frame = new JFrame("SwingBrowser"); frame.setMinimumSize(new Dimension(800, 600)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jfxPanel = new JFXPanel(); frame.getContentPane().add(jfxPanel, BorderLayout.CENTER); Application.launch(SwingBrowser.class, new String[0]); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } @Override public void start(Stage stage) { VBox root = new VBox(); root.setFillWidth(true); webEngine = new WebEngine("http://www.craftymind.com/guimark2"); WebView webView = new WebView(webEngine); root.getChildren().add(webView); Button button = new Button("Dummy FX button"); button.setMaxWidth(Double.MAX_VALUE); root.getChildren().add(button); Scene scene = new Scene(root); jfxPanel.setScene(scene); } }