当前位置: 首页>>代码示例>>Java>>正文


Java ScrollBar类代码示例

本文整理汇总了Java中javafx.scene.control.ScrollBar的典型用法代码示例。如果您正苦于以下问题:Java ScrollBar类的具体用法?Java ScrollBar怎么用?Java ScrollBar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ScrollBar类属于javafx.scene.control包,在下文中一共展示了ScrollBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initxScrollbar

import javafx.scene.control.ScrollBar; //导入依赖的package包/类
/**
 * 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());
  });
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:24,代码来源:TimingDiagramCollectionController.java

示例2: findScrollBar

import javafx.scene.control.ScrollBar; //导入依赖的package包/类
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);
}
 
开发者ID:joffrey-bion,项目名称:fx-log,代码行数:10,代码来源:ScrollBarMarker.java

示例3: TPSChart

import javafx.scene.control.ScrollBar; //导入依赖的package包/类
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();
        }
    } );
}
 
开发者ID:GoMint,项目名称:GoMint,代码行数:25,代码来源:TPSChart.java

示例4: drawNode

import javafx.scene.control.ScrollBar; //导入依赖的package包/类
@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;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:27,代码来源:ScrollBarApp.java

示例5: checkScrollingState

import javafx.scene.control.ScrollBar; //导入依赖的package包/类
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));
    }
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:20,代码来源:TestBase.java

示例6: getScroll

import javafx.scene.control.ScrollBar; //导入依赖的package包/类
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;
    }
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:18,代码来源:TestBaseCommon.java

示例7: adjustValueTest

import javafx.scene.control.ScrollBar; //导入依赖的package包/类
@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);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:24,代码来源:ScrollBarTest.java

示例8: checkScrollingState

import javafx.scene.control.ScrollBar; //导入依赖的package包/类
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));
    }
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:21,代码来源:NewListViewTest.java

示例9: ScrollBars_UNIT_INCREMENT

import javafx.scene.control.ScrollBar; //导入依赖的package包/类
@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);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:19,代码来源:ScrollBarsCssTest.java

示例10: getControlPane

import javafx.scene.control.ScrollBar; //导入依赖的package包/类
@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;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:18,代码来源:SphereTestApp.java

示例11: getControlsForSubScene

import javafx.scene.control.ScrollBar; //导入依赖的package包/类
@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;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:23,代码来源:SubSceneDepthTestApp.java

示例12: checkScroll

import javafx.scene.control.ScrollBar; //导入依赖的package包/类
@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");
        }
    }
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:20,代码来源:ListViewWrap.java

示例13: getScroll

import javafx.scene.control.ScrollBar; //导入依赖的package包/类
/**
 * 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");
    }
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:22,代码来源:TableTreeScroll.java

示例14: setTextAreaHeight

import javafx.scene.control.ScrollBar; //导入依赖的package包/类
@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);
}
 
开发者ID:dipu-bd,项目名称:Tuntuni,代码行数:20,代码来源:MessagingController.java

示例15: getScrollBars

import javafx.scene.control.ScrollBar; //导入依赖的package包/类
/**
 * 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;
			}
		}
	}
}
 
开发者ID:ivartanian,项目名称:JVx.javafx,代码行数:27,代码来源:FXScrollPane.java


注:本文中的javafx.scene.control.ScrollBar类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。