find JavaFX Scroll Bar from TableView - Java JavaFX

Java examples for JavaFX:Table

Description

find JavaFX Scroll Bar from TableView

Demo Code


//package com.java2s;

import javafx.geometry.Orientation;
import javafx.scene.Node;
import javafx.scene.control.ScrollBar;
import javafx.scene.control.TableView;

public class Main {
    private static ScrollBar findScrollBar(TableView tv, Orientation or) {
        ScrollBar sb = null;//from w  w  w.  ja  v a  2 s .  co  m

        for (Node n : tv.lookupAll(".scroll-bar")) {
            if (n instanceof ScrollBar) {
                ScrollBar bar = (ScrollBar) n;
                if (bar.getOrientation() == or) {
                    sb = bar;
                    break;
                }
            }
        }

        return sb;
    }
}

Related Tutorials