This is a tutorial about adding HTML content to JavaFX 2 applications. Here, we will load some web page, and display it in an embedded browser. The embedded browser component is based on WebKit, an open source web browser engine. It supports Cascading Style Sheets (CSS), JavaScript, Document Object Model (DOM), and HTML5. |
The embedded browser enables you to perform the following tasks in your JavaFX applications:
- Render HTML content from local and remote URLs
- Execute JavaScript commands
- Perform upcalls from JavaScript to JavaFX.
- Manage web pop-up windows
- Apply effects to the embedded browser
JavaFX 2 WebView |
WebView
and WebEngine
objects in your application.
Here is the code of JavaFX 2 WebView example:
If you like this, and other JavaFX 2 tutorials on this blog, you can like this blog on Facebook to be informed about new JavaFX tutorials.
hi i want to open four urls in a single page can you please help me
ReplyDeleteplease send me example code in j2se
My code is below and is failing to load the webView with the content. How can i best do it. Please help. Thanks
ReplyDeletepackage octopushr;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
public class AboutController implements Initializable {
@FXML
private WebView webView;
@FXML
private WebEngine engine;
@Override
public void initialize(URL url, ResourceBundle rb) {
engine = webView.getEngine();
engine.load("http://zoranpavlovic.blogspot.com/");
}
}