/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package javaapplication19; import java.util.concurrent.CountDownLatch; import java.util.logging.Level; import java.util.logging.Logger; import javafx.application.Application; import javafx.application.Platform; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.web.WebEngine; import javafx.stage.Stage; /** * * @author akouznet */ public class JavaApplication19 extends Application { private final CountDownLatch countDownLatch = new CountDownLatch(1); private volatile Object resultObject; public void start(Stage stage){ final Scene scene = new Scene(new Group()); stage.setTitle("Launcher"); stage.setScene(scene); stage.setWidth(800); stage.setHeight(600); stage.sizeToScene(); stage.show(); WebEngine engine = new WebEngine(); resultObject = engine.executeScript("document.createElement('span')"); System.out.println("resultObject instanceof org.w3c.dom.Node = " + (resultObject instanceof org.w3c.dom.Node)); countDownLatch.countDown(); new Thread(new Runnable() { @Override public void run() { try { countDownLatch.await(); } catch (InterruptedException ex) { Logger.getLogger(JavaApplication19.class.getName()).log(Level.SEVERE, null, ex); } System.out.println("resultObject = " + resultObject); } }).start(); } /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } }