if (n2 instanceof ScrollBar) { final ScrollBar bar2 = (ScrollBar) n2; bar1.valueProperty().bindBidirectional(bar2.valueProperty());
ObservableList<String> names = FXCollections.observableArrayList("1","2","3","4","5","6","7"); final ListView<String> listView = new ListView<String>(names); stage.setOnShown(new EventHandler<WindowEvent>(){ boolean hasRun = false; @Override public void handle(WindowEvent arg0) { if(!hasRun){ for (Node node: listView.lookupAll(".scroll-bar")) { if (node instanceof ScrollBar) { final ScrollBar bar = (ScrollBar) node; bar.valueProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> value, Number oldValue, Number newValue) { System.out.println(bar.getOrientation() + " " + newValue); } }); } } hasRun = true; } }});
scrollBar.valueProperty().bindBidirectional(scrollBar1.valueProperty()); scrollBar.valueProperty().bindBidirectional(scrollBar2.valueProperty());
ScrollBar bar = new ScrollBar(); VBox box = new VBox(); box.layoutYProperty().bind(bar.valueProperty());
bar.valueProperty().addListener((src, ov, nv) -> { LOG.info("change on value " + nv); if (nv.doubleValue() == 1.) {
if (n2 instanceof ScrollBar) { final ScrollBar bar2 = (ScrollBar) n2; bar1.valueProperty().bindBidirectional(bar2.valueProperty());
ScrollBar sb1 = (ScrollBar) lineNumbers.lookup(".scroll-bar:vertical"); ScrollBar sb2 = (ScrollBar) text.lookup(".scroll-bar:vertical"); sb1.valueProperty().bindBidirectional(sb2.valueProperty());
public AquaScrollBarSkin(ScrollBar scrollBar) { super(scrollBar); if (getNode().getParent() instanceof ScrollPane) { fadeable = true; } scrollBar.setVisible(!fadeable); registerChangeListener(scrollBar.hoverProperty(), "HOVER"); registerChangeListener(scrollBar.valueProperty(), "VALUE"); registerChangeListener(scrollBar.visibleProperty(), "VISIBLE"); }
@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(); }
draw(canvas, scrollBar.getValue()); scrollBar.valueProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> ov,
public void bind(ScrollBar bar) { bar.minProperty().bind(this.min); bar.maxProperty().bind(this.max); bar.visibleAmountProperty().bind(this.contentAreaHeight.divide(this.contentHeight.divide(this.max))); bar.valueProperty().bindBidirectional(this.offset); recomputeAll(); }
verticalBar.valueProperty().addListener((obs, oldValue, newValue) -> { if (newValue.doubleValue() >= verticalBar.getMax()) { addMoreData(table, 20);
sc.valueProperty().addListener(new ChangeListener<Number>() { public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) {
if (newStatus == Animation.Status.RUNNING) { scrollBar.setDisable(true); scrollBar.valueProperty().bind(scrollValueBinding); } else if (oldStatus == Animation.Status.RUNNING) { scrollBar.setDisable(false); scrollBar.valueProperty().unbind();
tableViewScrollBar.valueProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
public void bindHorizontalScrollbar(ScrollBar bar) { bar.setMin(0); DoubleBinding max = this.contentBody.widthProperty().subtract(widthProperty()); DoubleBinding factor = this.contentBody.widthProperty().divide(max); bar.maxProperty().bind(this.contentBody.widthProperty().divide(factor)); bar.visibleAmountProperty().bind(widthProperty().divide(factor)); this.offsetX.bind(bar.valueProperty()); }
vScrollBar.maxProperty().bind(scrollPane.vmaxProperty()); vScrollBar.visibleAmountProperty().bind(scrollPane.heightProperty().divide(pane.heightProperty())); scrollPane.vvalueProperty().bindBidirectional(vScrollBar.valueProperty()); hScrollBar.maxProperty().bind(scrollPane.hmaxProperty()); hScrollBar.visibleAmountProperty().bind(scrollPane.widthProperty().divide(pane.heightProperty())); scrollPane.hvalueProperty().bindBidirectional(hScrollBar.valueProperty());
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(); } } ); }
.orElseConst(0.0) .asVar(this::setVPosition); hbarValue = Var.doubleVar(hbar.valueProperty()); vbarValue = Var.doubleVar(vbar.valueProperty()); Bindings.bindBidirectional(hbarValue, hPosEstimate); Bindings.bindBidirectional(vbarValue, vPosEstimate);