import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.input.DataFormat;
import javafx.scene.input.DragEvent;
import javafx.scene.input.Dragboard;
import javafx.scene.web.WebView;
import javafx.stage.Stage;

public class WebTestApp extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception {
        final WebView webView = new WebView();
        webView.getEngine().locationProperty().addListener((obs, ov, nv) -> System.out.println("location = " + nv));
        webView.addEventHandler(DragEvent.DRAG_OVER, e -> {
            long time = System.currentTimeMillis();
            Dragboard db = e.getDragboard();
            db.getContent(DataFormat.IMAGE);
            System.out.println("DND readImage time = " + (System.currentTimeMillis()-time));
        });
        // 1. Drag first image https://openjdk.java.net/images/duke-thinking.png and observe readImage times
        webView.getEngine().load("https://openjdk.java.net");

        // 2. Then click top left link OpenJDK FAQ, https://openjdk.java.net/faq/

        // 3. Then drag the OpenJDK image https://openjdk.java.net/images/openjdk-small.png and observe readImage times

        primaryStage.setScene(new Scene(webView, 800, 600));
        primaryStage.show();
    }
}
