import javafx.application.Application; import javafx.embed.swing.JFXPanel; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.web.WebEngine; import javafx.scene.web.WebView; import javafx.stage.Stage; import javax.swing.JFrame; import javax.swing.SwingUtilities; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; public class MainTest extends Application { private static JFXPanel javafxPanel; private void initAndShowFrame() { JFrame frame = new JFrame("JxBrowser"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); javafxPanel = new JFXPanel(); javafxPanel.setPreferredSize(new Dimension(1024,800)); frame.getContentPane().add(javafxPanel, BorderLayout.CENTER); // Create JavaFX scene. Application.launch(MainTest.class, null); frame.setVisible(true); frame.setSize(new Dimension(1024, 800)); // if these following 3 lines are commented out, everything works fine. GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gs = ge.getDefaultScreenDevice(); gs.setFullScreenWindow(frame); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { MainTest jxBrowser = new MainTest(); jxBrowser.initAndShowFrame(); } }); } public void start(final Stage stage) throws Exception { //Create the scene and the stage Group root = new Group(); final Scene scene = new Scene(root); final WebEngine webEngine = new WebEngine(); WebView webView = new WebView(webEngine); webEngine.load("http://www.oracle.com"); root.getChildren().add(webView); // Add scene to panel javafxPanel.setScene(scene); } }