JavaFX: Webview

This entry is part 50 of 55 in the series JavaFX

You have heard of phonegap where you can develop your App in HTML/Javascript and publish it in Apple App store?  This is also called the non native App and judging from the trend, it seems to be getting more and more popular.

The single piece of module that makes it work is the Web View engine found in Java and Objective-C.

Consider the example below.  If my site is coded in Javascript/HTML, I can have it run on top of Java using just a few lines of code.

package webviewsample;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;

public class WebViewSample extends Application {

    public void start(Stage stage) {

        WebView view = new WebView();
        WebEngine engine = view.getEngine();
        Scene scene = new Scene(view, 400, 600);

    public static void main(String[] args) {



Series Navigation<< JavaFX: Putting drawings into group
JavaFX: Generating grid lines using group >>