Вопрос

I am trying to load a webpage into my application. I can get the page to load, however, the website I'm trying to load requires Java to run and the WebView cannot seem to find it on my MacBook. See my stripped code below:

public class LoadPage extends Application {

    public static WebView loadPage() {
        WebView browser = new WebView();
        WebEngine eng = browser.getEngine();
        eng.load("http://www.java.com/en/download/installed.jsp");
        return browser;
    }

    @Override
    public void start(Stage primaryStage) {
        try {
            BorderPane pane = new BorderPane();
            pane.setCenter(loadPage());
            Scene scene = new Scene(pane);
            scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
            primaryStage.setTitle("WebEditor");
            primaryStage.setScene(scene);
            primaryStage.show();

        } catch(Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        launch(args);
    }
}

Now my question is: Is there a workaround for this? Any help is much appreciated :)

Это было полезно?

Решение

No you cannot do that, the WebView currently doesn't support plugin technology ! Please see Jewelsea's answer over here !

Javafx: Java applet in a Webview component

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top