Ответ 1
Учитывая уже существующий jFrame
, следующий код добавляет новый WebView
и загружает URL-адрес:
// You should execute this part on the Event Dispatch Thread
// because it modifies a Swing component
JFXPanel jfxPanel = new JFXPanel();
jFrame.add(jfxPanel);
// Creation of scene and future interactions with JFXPanel
// should take place on the JavaFX Application Thread
Platform.runLater(() -> {
WebView webView = new WebView();
jfxPanel.setScene(new Scene(webView));
webView.getEngine().load("http://www.stackoverflow.com/");
});