Java 类javafx.scene.control.ScrollBar 实例源码

项目:stvs    文件:TimingDiagramCollectionController.java   
/**
 * Ensures that the scrollbar below the xAxis can only be used within the range of the shown data
 * and that the scrollbar position and shown range are always synchronized.
 */
private void initxScrollbar() {
  ScrollBar scrollBar = view.getXscrollBar();
  NumberAxis globalxAxis = view.getXaxis();
  scrollBar.setMin(0);
  visibleRange.bind(globalxAxis.upperBoundProperty().subtract(globalxAxis.lowerBoundProperty()));
  scrollBar.maxProperty().bind(visibleRange.multiply(-1).add(totalCycleCount));

  globalxAxis.lowerBoundProperty().addListener(change -> {
    scrollBar.setValue(globalxAxis.getLowerBound());
  });

  // I don't know, why it need to be divided by 2 but it seems to work very good this way
  scrollBar.visibleAmountProperty().bind(visibleRange.divide(2));

  scrollBar.valueProperty().addListener(change -> {
    globalxAxis.setUpperBound(scrollBar.getValue() + visibleRange.get());
    globalxAxis.setLowerBound(scrollBar.getValue());
  });
}
项目:fx-log    文件:ScrollBarMarker.java   
private static ScrollBar findScrollBar(TableView tableView, Orientation orientation) {
    return tableView.lookupAll(".scroll-bar")
                    .stream()
                    .filter(n -> n instanceof ScrollBar)
                    .map(n -> (ScrollBar) n)
                    .filter(sb -> sb.getOrientation() == orientation)
                    .findFirst()
                    .orElse(null);
}
项目:GoMint    文件:TPSChart.java   
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();
        }
    } );
}
项目:openjfx-8u-dev-tests    文件:ScrollBarApp.java   
@Override
public Node drawNode() {
    ScrollBar scroll = new ScrollBar();
    if (Double.compare(scroll.getValue(), 0) != 0) {
        reportGetterFailure("ScrollBar.getValue()");
    }
    if (Double.compare(scroll.getMin(), 0) != 0) {
        reportGetterFailure("ScrollBar.getMin()");
    }
    if (Double.compare(scroll.getMax(), 100) != 0) {
        reportGetterFailure("ScrollBar.getMax()");
    }
    if (Double.compare(scroll.getBlockIncrement(), 10) != 0) {
        reportGetterFailure("ScrollBar.getBlockIncrement()");
    }
    if (Double.compare(scroll.getUnitIncrement(), 1) != 0) {
        reportGetterFailure("ScrollBar.isVertical()");
    }
    if (scroll.getOrientation() != Orientation.HORIZONTAL) {
        reportGetterFailure("ScrollBar.isVertical()");
    }
    if (Double.compare(scroll.getVisibleAmount(), 15) != 0) {
        reportGetterFailure("ScrollBar.isVertical()");
    }
    return scroll;
}
项目:openjfx-8u-dev-tests    文件:TestBase.java   
protected void checkScrollingState(final double scrollValue, boolean beginVisible, boolean endVisible, int size) {
    testedControl.waitState(new State() {
        public Object reached() {
            Wrap<? extends ScrollBar> sb = findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true);
            if (Math.abs(sb.getControl().getValue() - scrollValue) < 0.01) {
                return true;
            } else {
                return null;
            }
        }
    });

    if (beginVisible) {
        assertTrue(isCellShown(0));
    }
    if (endVisible) {
        assertTrue(isCellShown(size - 1));
    }
}
项目:openjfx-8u-dev-tests    文件:TestBaseCommon.java   
private static AbstractScroll getScroll(final Wrap<? extends Control> testedControl, final boolean vertical) {
    Lookup<ScrollBar> lookup = testedControl.as(Parent.class, Node.class).lookup(ScrollBar.class,
            new LookupCriteria<ScrollBar>() {
                @Override
                public boolean check(ScrollBar control) {
                    return control.isVisible() && (control.getOrientation() == Orientation.VERTICAL) == vertical;
                }
            });
    int count = lookup.size();
    if (count == 0) {
        return null;
    } else if (count == 1) {
        return lookup.as(AbstractScroll.class);
    } else {
        return null;
    }
}
项目:openjfx-8u-dev-tests    文件:ScrollBarTest.java   
@Smoke
@Test(timeout = 300000)
public void adjustValueTest() throws InterruptedException {
    Wrap<? extends ScrollBar> testedScrollBar = parent.lookup(ScrollBar.class, new ByID<ScrollBar>(TESTED_SCROLLBAR_ID)).wrap();

    //Block - aboutclick over free space, Unit - about click on arrow.
    setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.blockIncrement, 50);
    setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.unitIncrement, 75);

    testedScrollBar.mouse().click();
    //knob in center
    clickLess(testedScrollBar);
    checkTextFieldValue(Properties.value, 0);

    setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.blockIncrement, 150);
    testedScrollBar.mouse().click();
    checkTextFieldValue(Properties.value, 50);

    testedScrollBar.keyboard().pushKey(KeyboardButtons.LEFT);
    checkTextFieldValue(Properties.value, 0);
    testedScrollBar.keyboard().pushKey(KeyboardButtons.RIGHT);
    checkTextFieldValue(Properties.value, 100);
}
项目:openjfx-8u-dev-tests    文件:NewListViewTest.java   
private void checkScrollingState(final double scrollValue, boolean beginVisible, boolean endVisible, int size, final Orientation orientation) {
    //assertEquals(findScrollBar(testedControl.as(Parent.class, Node.class), orientation, true).getControl().getValue(), scrollValue, 0.01);
    testedControl.waitState(new State() {
        public Object reached() {
            Wrap<? extends ScrollBar> sb = findScrollBar(testedControl.as(Parent.class, Node.class), orientation, true);
            if (Math.abs(sb.getControl().getValue() - scrollValue) < 0.01) {
                return true;
            } else {
                return null;
            }
        }
    });

    if (beginVisible) {
        assertTrue(isCellShown(0, orientation));
    }
    if (endVisible) {
        assertTrue(isCellShown(size, orientation));
    }
}
项目:openjfx-8u-dev-tests    文件:ScrollBarsCssTest.java   
@Test
public void ScrollBars_UNIT_INCREMENT() throws InterruptedException {
    testAdditionalAction(ScrollBars.name(), "UNIT-INCREMENT", false);
    Wrap<? extends Scene> scene = Root.ROOT.lookup(Scene.class).wrap();
    Assert.assertNotNull(scene);
    Parent<Node> sceneParent = scene.as(Parent.class, Node.class);
    Assert.assertNotNull(sceneParent);
    Wrap<? extends ScrollBar> scrollWrap = sceneParent.lookup(ScrollBar.class).wrap();
    Wrap decrementArrow = sceneParent.lookup(new ByStyleClass<Node>("decrement-arrow")).wrap();
    Wrap incrementArrow = sceneParent.lookup(new ByStyleClass<Node>("increment-arrow")).wrap();
    Assert.assertNotNull(decrementArrow);
    decrementArrow.mouse().click();
    Assert.assertEquals(scrollWrap.getControl().getValue(), 0, 0);
    incrementArrow.mouse().click();
    Assert.assertEquals(50.0d, scrollWrap.getControl().getValue(), 0);
    incrementArrow.mouse().click();
    Assert.assertEquals(100.0d, scrollWrap.getControl().getValue(), 0);
}
项目:openjfx-8u-dev-tests    文件:SphereTestApp.java   
@Override
public HBox getControlPane() {
    HBox cPane = new HBox();
    VBox radiusBox = new VBox();

    radiusScroll = new ScrollBar();
    radiusScroll.setMin(0);
    radiusScroll.setMax(6);
    radiusScroll.setValue(sphere.getRadius());
    radiusScroll.valueProperty().bindBidirectional(sphere.radiusProperty());

    radiusBox.getChildren().addAll(new Label("Radius"), radiusScroll);

    cPane.getChildren().add(radiusBox);

    return cPane;
}
项目:openjfx-8u-dev-tests    文件:SubSceneDepthTestApp.java   
@Override
protected VBox getControlsForSubScene(SubScene ss) {
    GroupMover targetMover;
    if(ss.getRoot() == rootDLMV.getGroup()){
        targetMover = rootDLMV;
    }else if(ss.getRoot() == rootTLMV.getGroup()){
        targetMover = rootTLMV;
    }else if(ss.getRoot() == rootTRMV.getGroup()){
        targetMover = rootTRMV;
    }else{
        throw new IllegalArgumentException("SubScene does not applicable to this application");
    }
    ScrollBar rotYBar = new ScrollBar();
    VBox controls = new VBox(new HBox(new Label("Rotate"),rotYBar));

    rotYBar.setMin(-360);
    rotYBar.setMax(360);
    rotYBar.setValue(targetMover.rotateYProperty().get());
    rotYBar.valueProperty().bindBidirectional(targetMover.rotateYProperty());

    return controls;
}
项目:openjfx-8u-dev-tests    文件:ListViewWrap.java   
@SuppressWarnings("unchecked")
private void checkScroll() {
    if (scroll == null) {
        final boolean vertical = vertical();
        final Parent<Node> parent = as(Parent.class, Node.class);
        Lookup<ScrollBar> lookup = parent.lookup(ScrollBar.class,
                control -> (control.getOrientation() == Orientation.VERTICAL) == vertical);
        int count = lookup.size();
        if (count == 0) {
            scroll = null;
        } else if (count == 1) {
            scroll = lookup.wrap(0).as(AbstractScroll.class);
        } else {
            throw new JemmyException("There are more than 1 "
                    + (vertical ? "vertical" : "horizontal")
                    + " ScrollBars in this ListView");
        }
    }
}
项目:openjfx-8u-dev-tests    文件:TableTreeScroll.java   
/**
 * Obtains wrap for scrollbar
 *
 * @param vertical
 * @return
 */
private AbstractScroll getScroll(final boolean vertical) {
    final Parent<Node> parent = control.as(Parent.class, Node.class);
    Lookup<ScrollBar> lookup = parent.lookup(ScrollBar.class,
            control -> (control.getOrientation() == Orientation.VERTICAL) == vertical
                    && control.isVisible());
    int count = lookup.size();
    if (count == 0) {
        return null;
    } else if (count == 1) {
        return lookup.as(AbstractScroll.class);
    } else {
        throw new JemmyException("There are more than 1 " + (vertical ? "vertical" : "horizontal")
                + " ScrollBars in this TableView");
    }
}
项目:Tuntuni    文件:MessagingController.java   
@Deprecated
private void setTextAreaHeight() {
    // elements
    Region content = (Region) messageText.lookup(".content");
    ScrollBar scrollBarv = (ScrollBar) messageText.lookup(".scroll-bar:vertical");
    // get the height of content
    double height = MINIMUM_HEIGHT;
    if (messageText.getText().length() > 10) {
        Insets padding = messageText.getPadding();
        height = content.getHeight() + padding.getTop() + padding.getBottom();
    }
    // set height
    height = Math.max(MINIMUM_HEIGHT, height);
    height = Math.min(MAXIMUM_HEIGHT, height);
    messageText.setMinHeight(height);
    messageText.setPrefHeight(height);
    // enable or the scroll bar
    scrollBarv.setVisibleAmount(MAXIMUM_HEIGHT);
}
项目:JVx.javafx    文件:FXScrollPane.java   
/**
 * Gets the horizontal and vertical {@link ScrollBar} and saves them in the
 * class members.
 * 
 * @see #horizontalScrollBar
 * @see #verticalScrollBar
 */
private void getScrollBars()
{
    for (Node node : lookupAll(".scroll-pane *.scroll-bar"))
    {
        if (node instanceof ScrollBar)
        {
            ScrollBar scrollBar = (ScrollBar)node;

            if (scrollBar.getOrientation() == Orientation.HORIZONTAL)
            {
                horizontalScrollBar = scrollBar;
            }
            else
            {
                verticalScrollBar = scrollBar;
            }
        }
    }
}
项目:javafx-demos    文件:TableViewPercentColumnDemo.java   
private boolean isVerticalScrollVisible(){
    Set<Node> sbs = (Set<Node>)table.lookupAll(".scroll-bar");
    if(sbs.size()>0){
        for (Node node : sbs) {
            if(node instanceof ScrollBar){
                ScrollBar scroll = (ScrollBar)node;
                if(scroll.getOrientation() == Orientation.VERTICAL){
                    if(scroll.isVisible()){
                        return true;
                    }
                }// eo Orientation
            } // eo instanceof
        }// eo for
    }// eo if
    return false;
}
项目:AsciidocFX    文件:FileBrowseService.java   
private void initializeScrollListener() {
    threadService.runActionLater(() -> {
        this.treeView = controller.getFileSystemView();

        Set<Node> nodes = this.treeView.lookupAll(".scroll-bar");
        for (Node node : nodes) {
            ScrollBar scrollBar = (ScrollBar) node;
            if (scrollBar.getOrientation() == Orientation.VERTICAL) {
                verticalScrollState.updateState(scrollBar);
                scrollBar.valueProperty().addListener((observable, oldValue, newValue) -> {
                    verticalScrollState.updateState(scrollBar, newValue);
                });
            } else if (scrollBar.getOrientation() == Orientation.HORIZONTAL) {
                horizontalScrollState.updateState(scrollBar);
                scrollBar.valueProperty().addListener((observable, oldValue, newValue) -> {
                    horizontalScrollState.updateState(scrollBar, newValue);
                });
            }
        }
    });
}
项目:AsciidocFX    文件:FileBrowseService.java   
private void restoreTreeScrollState() {

        threadService.schedule(() -> { // run after some ms
            threadService.runActionLater(() -> { // run in ui thread

                Set<Node> nodes = this.treeView.lookupAll(".scroll-bar");
                for (Node node : nodes) {
                    ScrollBar scrollBar = (ScrollBar) node;
                    if (scrollBar.getOrientation() == Orientation.VERTICAL) {
                        verticalScrollState.restoreState(scrollBar);
                    } else if (scrollBar.getOrientation() == Orientation.HORIZONTAL) {
                        horizontalScrollState.restoreState(scrollBar);
                    }
                }
            });
        }, 50, TimeUnit.MILLISECONDS);
    }
项目:marathonv5    文件:ScrollBarSample.java   
private ScrollBar horizontalScrollBar(double minw, double minh, double prefw, double prefh, double maxw, double maxh) {
    final ScrollBar scrollBar = new ScrollBar();
    scrollBar.setMinSize(minw, minh);
    scrollBar.setPrefSize(prefw, prefh);
    scrollBar.setMaxSize(maxw, maxh);
    scrollBar.setVisibleAmount(50);
    scrollBar.setMax(xBarWidth-(2*circleRadius));
    return scrollBar;
}
项目:marathonv5    文件:ScrollBarSample.java   
private ScrollBar verticalScrollBar(double minw, double minh, double prefw, double prefh, double maxw, double maxh) {
    final ScrollBar scrollBar = new ScrollBar();
    scrollBar.setMinSize(minw, minh);
    scrollBar.setPrefSize(prefw, prefh);
    scrollBar.setMaxSize(maxw, maxh);
    scrollBar.setVisibleAmount(50);
    scrollBar.setMax(yBarHeight-(2*circleRadius));
    return scrollBar;
}
项目:marathonv5    文件:ScrollBarSample.java   
private ScrollBar horizontalScrollBar(double minw, double minh, double prefw, double prefh, double maxw, double maxh) {
    final ScrollBar scrollBar = new ScrollBar();
    scrollBar.setMinSize(minw, minh);
    scrollBar.setPrefSize(prefw, prefh);
    scrollBar.setMaxSize(maxw, maxh);
    scrollBar.setVisibleAmount(50);
    scrollBar.setMax(xBarWidth-(2*circleRadius));
    return scrollBar;
}
项目:marathonv5    文件:ScrollBarSample.java   
private ScrollBar verticalScrollBar(double minw, double minh, double prefw, double prefh, double maxw, double maxh) {
    final ScrollBar scrollBar = new ScrollBar();
    scrollBar.setMinSize(minw, minh);
    scrollBar.setPrefSize(prefw, prefh);
    scrollBar.setMaxSize(maxw, maxh);
    scrollBar.setVisibleAmount(50);
    scrollBar.setMax(yBarHeight-(2*circleRadius));
    return scrollBar;
}
项目:Cypher    文件:ChatPresenter.java   
private ScrollBar getListViewScrollBar(ListView listView, Orientation orientation) {
    for(Node node : listView.lookupAll(".scroll-bar")) {
        if(node instanceof ScrollBar &&
           ((ScrollBar)node).getOrientation() == orientation) {
            return (ScrollBar)node;
        }
    }
    return null;
}
项目:CalendarFX    文件:HelloTimeScaleView.java   
@Override
public Node getPanel(Stage stage) {
    TimeScaleView view = new TimeScaleView();
    final DayViewScrollPane scrollPane = new DayViewScrollPane(view, new ScrollBar());
    scrollPane.setPrefHeight(2000);
    return wrap(scrollPane);
}
项目:CalendarFX    文件:HelloWeekView.java   
@Override
public Node getPanel(Stage stage) {
    Calendar dirk = new Calendar("Dirk");
    Calendar katja = new Calendar("Katja");
    Calendar philip = new Calendar("Philip");
    Calendar jule = new Calendar("Jule");
    Calendar armin = new Calendar("Armin");

    dirk.setStyle(Style.STYLE1);
    katja.setStyle(Style.STYLE2);
    philip.setStyle(Style.STYLE3);
    jule.setStyle(Style.STYLE4);
    armin.setStyle(Style.STYLE5);

    CalendarSource calendarSource = new CalendarSource();
    calendarSource.getCalendars().add(dirk);
    calendarSource.getCalendars().add(katja);
    calendarSource.getCalendars().add(philip);
    calendarSource.getCalendars().add(jule);
    calendarSource.getCalendars().add(armin);

    weekView.getCalendarSources().setAll(calendarSource);

    DayViewScrollPane scroll = new DayViewScrollPane(weekView, new ScrollBar());
    scroll.setStyle("-fx-background-color: white;");
    return scroll;
}
项目:CalendarFX    文件:AutoScrollPane.java   
private boolean isScrollBar(Node node) {
    boolean result = false;
    if (node instanceof ScrollBar) {
        result = true;
    } else if (node.getParent() != null) {
        return isScrollBar(node.getParent());
    }

    return result;
}
项目:ExtremeGuiMakeover    文件:PrettyListView.java   
private void bindScrollBars() {
    final Set<Node> nodes = lookupAll("VirtualScrollBar");
    for (Node node : nodes) {
        if (node instanceof ScrollBar) {
            ScrollBar bar = (ScrollBar) node;
            if (bar.getOrientation().equals(Orientation.VERTICAL)) {
                bindScrollBars(vBar, bar);
            } else if (bar.getOrientation().equals(Orientation.HORIZONTAL)) {
                bindScrollBars(hBar, bar);
            }
        }
    }
}
项目:ExtremeGuiMakeover    文件:PrettyListView.java   
private void bindScrollBars(ScrollBar scrollBarA, ScrollBar scrollBarB) {
    scrollBarA.valueProperty().bindBidirectional(scrollBarB.valueProperty());
    scrollBarA.minProperty().bindBidirectional(scrollBarB.minProperty());
    scrollBarA.maxProperty().bindBidirectional(scrollBarB.maxProperty());
    scrollBarA.visibleAmountProperty().bindBidirectional(scrollBarB.visibleAmountProperty());
    scrollBarA.unitIncrementProperty().bindBidirectional(scrollBarB.unitIncrementProperty());
    scrollBarA.blockIncrementProperty().bindBidirectional(scrollBarB.blockIncrementProperty());
}
项目:GestureFX    文件:GesturePane.java   
public GesturePane() {
    super();
    getStyleClass().setAll(DEFAULT_STYLE_CLASS);
    target.addListener((o, p, n) -> {
        if (n == null) return;
        content.set(null);
        runLaterOrNowIfOnFXThread(() -> {
            // TODO what if n is null?
            getChildren().removeIf(x -> !(x instanceof ScrollBar));
            n.setTransform(affine);
            targetWidth.set(n.width());
            targetHeight.set(n.height());
        });
    });

    final ChangeListener<Bounds> layoutBoundsListener = (o, p, n) -> {
        targetWidth.set(n.getWidth());
        targetHeight.set(n.getHeight());
    };
    content.addListener((o, p, n) -> {
        if (p != null)
            p.layoutBoundsProperty().removeListener(layoutBoundsListener);
        if (n == null) return;
        target.set(null);
        runLaterOrNowIfOnFXThread(() -> {
            // TODO what if n is null?
            getChildren().add(0, n);
            n.getTransforms().add(affine);
            n.layoutBoundsProperty().addListener(layoutBoundsListener);
            targetWidth.set(n.getLayoutBounds().getWidth());
            targetHeight.set(n.getLayoutBounds().getHeight());
        });
    });
}
项目:GestureFX    文件:GesturePaneTest.java   
private static Condition<Node> createBarCondition(Orientation orientation, boolean visible) {
    return new Condition<>(n -> {
        if (n instanceof ScrollBar) {
            ScrollBar bar = (ScrollBar) n;
            return ((ScrollBar) n).getOrientation() == orientation &&
                           visible == bar.isManaged() &&
                           visible == bar.isVisible();
        } else return false;
    }, "Is ScrollBar " + orientation + " and " + (visible ? "visible" : "hidden"));
}
项目:main    文件:MainController.java   
/**
 * Disable the scroll bar in the command area when it appears.
 */
private void disableScrollBarCmd() {
    cmdArea.textProperty().addListener((observable, oldValue, newValue) -> {
        if (cmdArea.lookup(".scroll-bar") != null) {
            ScrollBar scrollBarv = (ScrollBar) cmdArea.lookup(".scroll-bar");
            scrollBarv.setDisable(false);
            scrollBarv.setId("command-scroll-bar");
        }
    });
}
项目:FxEditor    文件:FxEditor.java   
protected ScrollBar createVScrollBar()
{
    ScrollBar s = new ScrollBar();
    s.setOrientation(Orientation.VERTICAL);
    s.setManaged(true);
    s.setMin(0.0);
    s.setMax(1.0);
    s.valueProperty().addListener((src,old,val) -> setAbsolutePositionVertical(val.doubleValue()));
    s.addEventFilter(ScrollEvent.ANY, (ev) -> ev.consume());
    return s;
}
项目:FxEditor    文件:FxEditor.java   
protected ScrollBar createHScrollBar()
{
    ScrollBar s = new ScrollBar();
    s.setOrientation(Orientation.HORIZONTAL);
    s.setManaged(true);
    s.setMin(0.0);
    s.setMax(1.0);
    s.valueProperty().addListener((src,old,val) -> setAbsolutePositionHorizontal(val.doubleValue()));
    s.addEventFilter(ScrollEvent.ANY, (ev) -> ev.consume());
    return s;
}
项目:megan-ce    文件:FXUtilities.java   
/**
 * Find the scrollbar of the given table.
 *
 * @param node
 * @return
 */
public static ScrollBar findScrollBar(Node node, Orientation orientation) {
    Set<Node> below = node.lookupAll(".scroll-bar");
    for (final Node nodeBelow : below) {
        if (nodeBelow instanceof ScrollBar) {
            ScrollBar sb = (ScrollBar) nodeBelow;
            if (sb.getOrientation() == orientation) {
                return sb;
            }
        }
    }
    return null;
}
项目:chvote-1-0    文件:KeyTestingController.java   
private void bindScrollBars() {
    ScrollBar plainTextScrollBar = plainTextList.lookupAll(".scroll-bar").stream().map(e -> (ScrollBar) e).filter(e -> e.getOrientation().equals(Orientation.HORIZONTAL)).findFirst().orElse(null);
    ScrollBar decryptedTextScrollBar = decryptedTextList.lookupAll(".scroll-bar").stream().map(e -> (ScrollBar) e).filter(e -> e.getOrientation().equals(Orientation.HORIZONTAL)).findFirst().orElse(null);

    if (plainTextScrollBar != null && decryptedTextScrollBar != null) {
        plainTextScrollBar.valueProperty().bindBidirectional(decryptedTextScrollBar.valueProperty());
    } else {
        LOGGER.error("couldn't find scrollbars");
    }
}
项目:openjfx-8u-dev-tests    文件:ScrollBarApp.java   
@Override
public Node drawNode() {
    ScrollBar scroll = createScroll(0, 100, vertical);
    scroll.setValue(50);
    scroll.setBlockIncrement(20);
    double new_value = scroll.getValue();
    double desired = scroll.getMin() + position * (scroll.getMax() - scroll.getMin());
    int direction = Double.compare(new_value, desired);
    scroll.adjustValue(position);
    if (direction != 0 && !Double.isNaN(position)) {
        double increment = scroll.getBlockIncrement();
        if (Math.abs(desired - new_value) < increment) {
            new_value = desired;
        } else {
            if (direction == 1) {
                new_value -= increment;
            } else {
                new_value += increment;
            }
        }
        if (new_value < scroll.getMin()) {
            new_value = scroll.getMin();
        }
        if (new_value > scroll.getMax()) {
            new_value = scroll.getMax();
        }
        if (Double.compare(scroll.getValue(), new_value) != 0) {
            reportGetterFailure("ScrollBar.adjustValue()");
        }
    }

    return scroll;
}
项目:openjfx-8u-dev-tests    文件:ScrollBarApp.java   
@Override
public Node drawNode() {
    ScrollBar scroll = createScroll(0, 100, vertical);
    scroll.setValue(50);
    scroll.setUnitIncrement(step);
    if (Double.compare(scroll.getUnitIncrement(), step) != 0) {
        reportGetterFailure("ScrollBar.getBlockIncrement()");
    }
    for (int i = 0; i < count; i++) {
        double val = scroll.getValue();
        if (decrement) {
            scroll.decrement();
            val -= step;
        } else {
            scroll.increment();
            val += step;
        }
        if (val < scroll.getMin()) {
            val = scroll.getMin();
        }
        if (val > scroll.getMax()) {
            val = scroll.getMax();
        }
        if (Double.compare(scroll.getValue(), val) != 0) {
            reportGetterFailure("ScrollBar.decrement()");
        }
    }
    return scroll;
}
项目:openjfx-8u-dev-tests    文件:ScrollBarApp.java   
@Override
public Node drawNode() {
    ScrollBar scroll = createScroll(min, max, vertical);
    scroll.setValue(value);
    if (Double.compare(scroll.getMin(), min) != 0) {
        reportGetterFailure("Slider.getMin()");
    }
    if (Double.compare(scroll.getMax(), max) != 0) {
        reportGetterFailure("Slider.getMax()");
    }
    if (Double.compare(scroll.getValue(), value) != 0) {
        reportGetterFailure("Slider.getValue()");
    }
    return scroll;
}
项目:openjfx-8u-dev-tests    文件:ScrollBarApp.java   
@Override
public Node drawNode() {
    ScrollBar scroll = createScroll(0, 100, vertical);
    scroll.setVisibleAmount(amount);
    if (Double.compare(scroll.getVisibleAmount(), amount) != 0) {
        reportGetterFailure("Slider.getVisibleAmount()");
    }
    return scroll;
}
项目:openjfx-8u-dev-tests    文件:ScrollBarApp.java   
protected ScrollBar createScroll(double min, double max, boolean vertical) {
    ScrollBar scroll = new ScrollBar();
    scroll.setOrientation(vertical ? Orientation.VERTICAL : Orientation.HORIZONTAL);
    scroll.setMin(min);
    scroll.setMax(max);
    return scroll;
}