Esempio n. 1
0
  private DoubleBinding createYPositionBinding(StackPane track, ScrollBar scrollBar) {
    Callable<Double> getY =
        () -> {
          double height = track.getLayoutBounds().getHeight();
          return scalePosition(position.get(), height, scrollBar);
        };

    return Bindings.createDoubleBinding(
        getY,
        position,
        alignment,
        thickness,
        track.layoutBoundsProperty(),
        scrollBar.minProperty(),
        scrollBar.maxProperty());
  }
Esempio n. 2
0
  private DoubleBinding createXPositionBinding(StackPane track, ScrollBar scrollBar) {
    Callable<Double> getX =
        () -> {
          double width = track.getLayoutBounds().getWidth();
          return scalePosition(position.get(), width, scrollBar);
        };

    return Bindings.createDoubleBinding(
        getX,
        position,
        alignment,
        thickness,
        track.layoutBoundsProperty(),
        scrollBar.minProperty(),
        scrollBar.maxProperty());
  }