JavaFX WebEngine web Doc Load Completed - Java JavaFX

Java examples for JavaFX:Web View

Description

JavaFX WebEngine web Doc Load Completed

Demo Code


//package com.java2s;

import org.w3c.dom.Document;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.concurrent.Worker;
import javafx.concurrent.Worker.State;

import javafx.scene.web.WebEngine;

public class Main {
    public static void webDocLoadCompleted(final WebEngine webEngine) {
        webEngine.getLoadWorker().stateProperty()
                .addListener(new ChangeListener<State>() {
                    public void changed(ObservableValue ov, State oldState,
                            State newState) {

                        if (newState == Worker.State.SUCCEEDED) {

                            System.out.println("called");
                            Document doc = webEngine.getDocument();
                            System.out.println(doc);
                            //   doc.getElementById("ueberschr").setTextContent("BliiiiiiiiiBaaaaaa...");
                        }/*from www .ja v a 2  s. c o m*/

                    }

                });
    }
}

Related Tutorials