本文整理汇总了Java中javafx.scene.control.ScrollBar.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java ScrollBar.setValue方法的具体用法?Java ScrollBar.setValue怎么用?Java ScrollBar.setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.ScrollBar
的用法示例。
在下文中一共展示了ScrollBar.setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: drawNode
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
@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;
}
示例4: minGreatedThenMaxTest
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
@Smoke
@Test(timeout = 300000)
public void minGreatedThenMaxTest() {
ScrollBar sb = new ScrollBar();
sb.setMin(100);
sb.setMax(0);
sb.setValue(50);
assertEquals(sb.getMin(), 100, ASSERT_CMP_PRECISION);
assertEquals(sb.getMax(), 0, ASSERT_CMP_PRECISION);
}
示例5: getControlPane
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
@Override
public HBox getControlPane() {
HBox cPane = new HBox();
VBox radiusBox = new VBox();
VBox heightBox = new VBox();
radiusScroll = new ScrollBar();
radiusScroll.setMin(0.1);
radiusScroll.setMax(6);
radiusScroll.setValue(cylinder.getRadius());
radiusScroll.valueProperty().bindBidirectional(cylinder.radiusProperty());
radiusBox.getChildren().addAll(new Label("Radius"), radiusScroll);
heightScroll = new ScrollBar();
heightScroll.setMin(0.1);
heightScroll.setMax(10);
heightScroll.setValue(cylinder.getHeight());
heightScroll.valueProperty().bindBidirectional(cylinder.heightProperty());
heightBox.getChildren().addAll(new Label("Height"), heightScroll);
cPane.getChildren().addAll(radiusBox, heightBox);
return cPane;
}
示例6: getControlPane
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
@Override
public HBox getControlPane() {
HBox cPane = new HBox();
VBox widthBox = new VBox();
VBox heightBox = new VBox();
VBox depthBox = new VBox();
depthScroll = new ScrollBar();
depthScroll.setMin(0);
depthScroll.setMax(10);
depthScroll.setValue(box.getDepth());
depthScroll.valueProperty().bindBidirectional(box.depthProperty());
depthBox.getChildren().addAll(new Label("depth"), depthScroll);
heightScroll = new ScrollBar();
heightScroll.setMin(0);
heightScroll.setMax(10);
heightScroll.setValue(box.getHeight());
heightScroll.valueProperty().bindBidirectional(box.heightProperty());
heightBox.getChildren().addAll(new Label("height"), heightScroll);
widthScroll = new ScrollBar();
widthScroll.setMin(0);
widthScroll.setMax(10);
widthScroll.setValue(box.getWidth());
widthScroll.valueProperty().bindBidirectional(box.widthProperty());
widthBox.getChildren().addAll(new Label("width"), widthScroll);
cPane.getChildren().addAll(depthBox, heightBox, widthBox);
return cPane;
}
示例7: dragScroll
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
protected void dragScroll()
{
ScrollBar b = getVerticalScrollbar(tree);
if(b != null)
{
double d = FX.clip(b.getValue() + scrollDirection, 0, 1);
b.setValue(d);
}
}
示例8: scrolled
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
void scrolled(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
double value = newValue.doubleValue();
System.out.println("Scrolled to " + value);
ScrollBar bar = getVerticalScrollbar(table);
if (value == bar.getMax()) {
System.out.println("Adding new persons.");
double targetValue = value * items.size();
addPersons();
bar.setValue(targetValue / items.size());
}
}
示例9: start
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
@Override // Override the start method in the Application class
public void start(Stage primaryStage) {
MultipleBallPane ballPane = new MultipleBallPane();
ballPane.setStyle("-fx-border-color: yellow");
Button btAdd = new Button("+");
Button btSubtract = new Button("-");
HBox hBox = new HBox(10);
hBox.getChildren().addAll(btAdd, btSubtract);
hBox.setAlignment(Pos.CENTER);
// Add or remove a ball
btAdd.setOnAction(e -> ballPane.add());
btSubtract.setOnAction(e -> ballPane.subtract());
// Pause and resume animation
ballPane.setOnMousePressed(e -> ballPane.pause());
ballPane.setOnMouseReleased(e -> ballPane.play());
// Use a scroll bar to control animation speed
ScrollBar sbSpeed = new ScrollBar();
sbSpeed.setMax(20);
sbSpeed.setValue(10);
ballPane.rateProperty().bind(sbSpeed.valueProperty());
BorderPane pane = new BorderPane();
pane.setCenter(ballPane);
pane.setTop(sbSpeed);
pane.setBottom(hBox);
// Create a scene and place the in the stage
Scene scene = new Scene(pane, 250, 150);
primaryStage.setTitle("Exercise_20_09"); // Set the stage title
primaryStage.setScene(scene); // Place the scene in the stage
primaryStage.show(); // Display the stage
}
示例10: scrollToTop
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
private void scrollToTop() {
final Node tabContent = this.tabPane.getSelectedItem().getContent();
final ScrollBar vBar = (ScrollBar) tabContent.lookup(".scroll-bar:vertical");
if (vBar != null) {
vBar.setValue(0.0D);
vBar.setVisible(true);
}
}
示例11: setScrollBarRange
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
private void setScrollBarRange( ScrollBar scrollBar, double screenSize, double objectSize ) {
double range = Math.max( 0, objectSize - screenSize );
scrollBar.setValue( Math.min( scrollBar.getValue(), range ) );
scrollBar.setMax( range );
scrollBar.setBlockIncrement( range/100 );
scrollBar.setVisibleAmount( range * (screenSize/objectSize) );
}
示例12: moveScrollBar
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
private void moveScrollBar(double newScrollBarValue, ScrollBar scrollbar) {
if (newScrollBarValue < 0) {
newScrollBarValue = 0;
}
if (newScrollBarValue > 1) {
newScrollBarValue = 1;
}
scrollbar.setValue(newScrollBarValue);
}
示例13: getSimpleBar
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
public static Node getSimpleBar(){
ScrollBar sb = new ScrollBar();
sb.setMin(0);
sb.setMax(100);
sb.setValue(20);
sb.setOrientation(Orientation.VERTICAL);
return sb;
}
示例14: restoreState
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
public void restoreState(ScrollBar scrollBar) {
if (value > 0) {
updateState(scrollBar);
scrollBar.setMin(getMin());
scrollBar.setMax(getMax());
scrollBar.setUnitIncrement(getUnitIncrement());
scrollBar.setBlockIncrement(getBlockIncrement());
scrollBar.setValue(value);
}
}
示例15: start
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
@Override // Override the start method in the Application class
public void start(Stage primaryStage) {
MultipleBallPane ballPane = new MultipleBallPane();
ballPane.setStyle("-fx-border-color: yellow");
// Create four buttons
Button btSuspend = new Button("Suspend");
Button btResume = new Button("Resume");
Button btAdd = new Button("+");
Button btSubtract = new Button("-");
HBox hBox = new HBox(10);
hBox.getChildren().addAll(
btSuspend, btResume, btAdd, btSubtract);
hBox.setAlignment(Pos.CENTER);
// Add or remove a ball
btAdd.setOnAction(e -> ballPane.add());
btSubtract.setOnAction(e -> ballPane.subtract());
ballPane.setOnMousePressed(e -> {
for (Node node: ballPane.getChildren()) {
Ball ball = (Ball)node;
if (ball.contains(e.getX(), e.getY())) {
ballPane.getChildren().remove(ball);
}
}
});
// Pause and resume animation
btSuspend.setOnAction(e -> ballPane.pause());
btResume.setOnAction(e -> ballPane.play());
// Use a scroll bar to control animation speed
ScrollBar sbSpeed = new ScrollBar();
sbSpeed.setMax(20);
sbSpeed.setValue(10);
ballPane.rateProperty().bind(sbSpeed.valueProperty());
// Create a border pane
BorderPane pane = new BorderPane();
pane.setCenter(ballPane);
pane.setTop(sbSpeed);
pane.setBottom(hBox);
// Create a scene and place the in the stage
Scene scene = new Scene(pane, 350, 200);
primaryStage.setTitle("Exercise_20_05"); // Set the stage title
primaryStage.setScene(scene); // Place the scene in the stage
primaryStage.show(); // Display the stage
}