make JavaFX Node Scrollable - Java JavaFX

Java examples for JavaFX:Node

Description

make JavaFX Node Scrollable

Demo Code


//package com.java2s;
import javafx.scene.Node;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.TableView;

public class Main {
    public static Node makeScrollable(Node content) {

        ScrollPane scrollPane = new ScrollPane();
        scrollPane.getStyleClass().addAll("noborder-scroll-pane",
                "texture-bg");
        scrollPane.setFitToWidth(true);/*from   w  w  w.  ja  v a2  s  .  c  o m*/
        scrollPane.setContent(content);

        return scrollPane;
    }

    public static Node makeScrollable(TableView<?> table) {

        ScrollPane scrollPane = new ScrollPane();
        scrollPane.setPrefHeight(300);
        scrollPane.setContent(table);

        return scrollPane;
    }
}

Related Tutorials