Example usage for javafx.scene.web WebView setMaxSize

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

Introduction

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

Prototype

public void setMaxSize(double maxWidth, double maxHeight) 

Source Link

Document

Convenience method for setting maximum width and height.

Usage

From source file:view.TimelinePanel.java

/**
 * Creates new form TimelinePanel/*ww w  .j a  va 2  s . c  o m*/
 */
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");
        }
    });
}