Advertisement
Guest User

Untitled

a guest
Feb 5th, 2013
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.20 KB | None | 0 0
  1.       // This is executed:      
  2.                 SwingUtilities.invokeLater(new Runnable() {
  3.             public void run() {
  4.                 new JFXPanel(); //Somehow prepares the JavaFX toolkit
  5.                                
  6.                                 // Other stuff is done here
  7.                                
  8.                                 Platform.runLater(new Runnable() {
  9.                            public void run() {
  10.                               test(); // The code below
  11.                            }
  12.                         });
  13.             }
  14.         });
  15.                
  16. /////////////////////////////////////////////////////
  17.  
  18.        void test() {
  19.                
  20.                 JFXPanel jfx = new JFXPanel();
  21.        
  22.         final JFrame dialog = new JFrame();
  23.         dialog.setTitle("I'm a dialog");
  24.         BorderPane root = new BorderPane();
  25.         dialog.setSize(880, 550);
  26.         dialog.setResizable(false);
  27.         Scene ds = new Scene(root);
  28.         jfx.setScene(ds);
  29.         dialog.add(jfx);
  30.         dialog.setVisible(true);
  31.        
  32.         WebView browser = new WebView();
  33.         browser.setDisable(true);
  34.         WebEngine webEngine = browser.getEngine();
  35.         webEngine.load("http://www.example.com"); //When commenting this line out, the crash does not occur.
  36.        
  37.         root.setCenter(browser);
  38.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement