ScrollBar bar = new ScrollBar(); VBox box = new VBox(); box.layoutYProperty().bind(bar.valueProperty());
final ScrollBar scrollBar = new ScrollBar(); Button btn = new Button("Reset"); btn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { scrollBar.setValue(scrollBar.getMin()); // Or if you have stored initial value somewhere use it scrollBar.setValue(myInitialValue); } });
@Override public void start(Stage primaryStage) { ScrollBar scrollBar = new ScrollBar(); scrollBar.setOrientation(Orientation.VERTICAL); scrollBar.setMax(100); scrollBar.setVisibleAmount(50); scrollBar.valueProperty().addListener((a,b,c) -> System.out.println(c)); StackPane root = new StackPane(); root.getChildren().add(scrollBar); Scene scene = new Scene(root, 200, 500); // do layout root.applyCss(); root.layout(); ScrollBarMark mark1 = new ScrollBarMark(); ScrollBarMark mark2 = new ScrollBarMark(); mark1.attach(scrollBar); mark2.attach(scrollBar); mark1.setPosition(50); mark2.setPosition(75); primaryStage.setScene(scene); primaryStage.show(); }
ScrollBar scrollBar = new ScrollBar(); scrollBar.setMin(0); scrollBar.setMax(TOTAL_WIDTH - canvas.getWidth());
final ScrollBar sc = new ScrollBar(); root.getChildren().addAll(anchorPane, sc);
public TPSChart() { final NumberAxis yAxis = new NumberAxis(); this.xAxis = new NumberAxis( 0, 512, 1000 ); this.xAxis.setAutoRanging( false ); this.chart = new LineChart<>( xAxis, yAxis ); this.chart.setAnimated( false ); this.chart.setCreateSymbols( false ); this.chart.setLegendVisible( false ); this.fullTimeSeries = new XYChart.Series<>(); this.actualTimeSeries = new XYChart.Series<>(); this.averageTimeSeries = new XYChart.Series<>(); this.scrollBar = new ScrollBar(); this.scrollBar.valueProperty().addListener( new ChangeListener<Number>() { @Override public void changed( ObservableValue<? extends Number> observable, Number oldValue, Number newValue ) { currentDataStart = (int) ( newValue.floatValue() * ( TimeUnit.SECONDS.toNanos( 1 ) / tickNanos ) * 60 ); updateChart(); } } ); }
scrollPane.setContent(pane); ScrollBar vScrollBar = new ScrollBar(); vScrollBar.setOrientation(Orientation.VERTICAL); vScrollBar.minProperty().bind(scrollPane.vminProperty()); scrollPane.vvalueProperty().bindBidirectional(vScrollBar.valueProperty()); ScrollBar hScrollBar = new ScrollBar(); hScrollBar.setOrientation(Orientation.HORIZONTAL); hScrollBar.minProperty().bind(scrollPane.hminProperty());
buttonBox.getChildren().add(link); buttonBox.getChildren().add(link2); ScrollBar scBar = new ScrollBar(); buttonBox.getChildren().add(scBar);
newDetailedSection( new String[] {"Scrollbar - H: ", "normal", "focused", "small", "big thumb"}, new ScrollBar(), withState(ScrollBarBuilder.create().build(), "focused"), ScrollBarBuilder.create().minWidth(30).prefWidth(30).build(),