I am trying to display a html page using WebView in JFXpanel. When I run the given code I get proper output i.e website("stack overflow") as mentioned in the load method.
WebView webView = new WebView();
jfxPanel.setScene(new Scene(webView));
webView.getEngine().load("http://www.stackoverflow.com/");
But when I replace the link with a local html file it doesnt give the desired output.
Found this:
public void start(Stage stage) {
try {
WebView web = new WebView();
String path = System.getProperty("user.dir");
path.replace("\\\\", "/");
path += "/html/index.html";
web.getEngine().load("file:///" + path);
Scene scene = new Scene(web, 400,400);
stage.setScene(scene);
stage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
https://community.oracle.com/thread/3519040?start=0&tstart=0