javajavafx-2javafx

How to set the desired position scrollpane?


Method sp.setVvalue(app.spvalue.intValue()); doesn't scroll vbox to desired position.

            mvPane = new VBox();
            mvPane.setStyle("-fx-background-color: #fff;");
            GetPlayList(app,root);

            sp = new ScrollPane();
            sp.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
            sp.setContent(mvPane);
            sp.setVvalue(40);
            setCenter(sp);
            sp.getVvalue();

Function GetPlayList adds many labels.


Solution

  • If you are talking about JavaFX 2.0, and its scrollPane, then Hvalue and Vvalue properties are working well, but the matter, look like, that their values are doubles from range [0.0 .. 1.0], so, when you set int value, it will not work fine.