Example usage for javafx.scene.web WebView setMinSize

List of usage examples for javafx.scene.web WebView setMinSize

Introduction

In this page you can find the example usage for javafx.scene.web WebView setMinSize.

Prototype

public void setMinSize(double minWidth, double minHeight) 

Source Link

Document

Convenience method for setting minimum width and height.

Usage

From source file:view.TimelinePanel.java

/**
 * Creates new form TimelinePanel//from www.  java 2 s .c  om
 */
public TimelinePanel() {
    initComponents();

    fxPanel = new JFXPanel();
    final Dimension size = new Dimension(960, 750);
    fxPanel.setSize(size);
    setLayout(new BorderLayout(0, 0));
    add(fxPanel);

    Platform.runLater(new Runnable() { // this will run initFX as JavaFX-Thread
        @Override
        public void run() {
            Group group = new Group();
            Scene scene = new Scene(group);
            fxPanel.setScene(scene);

            WebView webView = new WebView();

            group.getChildren().add(webView);
            webView.setMinSize(size.getWidth(), size.getHeight());
            webView.setMaxSize(size.getWidth(), size.getHeight());

            WebEngine webEngine = webView.getEngine();
            webEngine.load(
                    "http://cdn.knightlab.com/libs/timeline/latest/embed/index.html?source=0Ag1_iE674IuvdEFaZi0wOVBFY2l2OHdPUWlrZEMwaHc&font=Bevan-PotanoSans&maptype=toner&lang=en");
        }
    });
}