chikadance
chikadance

Reputation: 4167

How to get ScrollPane max vvalue

I can get current vvalue with following code:

    s1.vvalueProperty().addListener(new ChangeListener<Number>() {
        public void changed(ObservableValue<? extends Number> ov,
                            Number old_val, Number new_val) {
            println("s1.vvalue:${s1.vvalue.inspect()}")
            System.out.println(new_val.intValue());
        }
    });

How to listen ScrollPane is scrolled to the end?(how to get max vvalue?)

Upvotes: 0

Views: 195

Answers (2)

lmat - Reinstate Monica
lmat - Reinstate Monica

Reputation: 7768

Much better than hard-coding 1.0, call ScrollPane.getVMax(). If the value changes in the future, your application might not break!

https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/ScrollPane.html#getVmax--

Upvotes: 1

chikadance
chikadance

Reputation: 4167

I find the solution:

when scroll to the end, the vvalue is 1.0

Upvotes: 0

Related Questions