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


Java Slider.getValue方法代码示例

本文整理汇总了Java中javafx.scene.control.Slider.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java Slider.getValue方法的具体用法?Java Slider.getValue怎么用?Java Slider.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.control.Slider的用法示例。


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

示例1: WidthPanel

import javafx.scene.control.Slider; //导入方法依赖的package包/类
/**
    * Create a WidthPanel object.
    */
   public WidthPanel() {
// Create the GUI.
setAlignment(Pos.CENTER);
widthSlider = new Slider(0.1, 100.0, Properties.getWidth());
widthLabel = new Label("Width: " + (int) widthSlider.getValue());
widthLabel.setTextFill(Defaults.TEXT_COLOR);

// Setup what happens when the slider changes.
widthSlider.valueProperty().addListener(new ChangeListener<Number>() {
    @Override
    public void changed(ObservableValue<? extends Number> ov, Number oldVal, Number newVal) {
	// Make it look good with a format.
	int val = newVal.intValue();
	widthLabel.setText("Width: " + val);
	Properties.setWidth(val);
    }

});

// Add the Nodes.
getChildren().add(widthLabel);
getChildren().add(widthSlider);
   }
 
开发者ID:mpeterson2,项目名称:Whiteboard,代码行数:27,代码来源:WidthPanel.java

示例2: positionThumb

import javafx.scene.control.Slider; //导入方法依赖的package包/类
/**
 * Called when ever either min, max or value changes, so thumb's layoutX, Y is recomputed.
 */
void positionThumb(final boolean animate) {
    Slider s = getSkinnable();
    if (s.getValue() > s.getMax()) return;// this can happen if we are bound to something
    boolean horizontal = s.getOrientation() == Orientation.HORIZONTAL;
    final double endX = (horizontal) ? trackStart + (((trackLength * ((s.getValue() - s.getMin()) /
            (s.getMax() - s.getMin()))) - thumbWidth / 2)) : thumbLeft;
    final double endY = (horizontal) ? thumbTop :
            snappedTopInset() + trackLength - (trackLength * ((s.getValue() - s.getMin()) /
                    (s.getMax() - s.getMin()))); //  - thumbHeight/2

    if (animate) {
        // lets animate the thumb transition
        final double startX = thumb.getLayoutX();
        final double startY = thumb.getLayoutY();
        Transition transition = new Transition() {
            {
                setCycleDuration(Duration.millis(200));
            }

            @Override
            protected void interpolate(double frac) {
                if (!Double.isNaN(startX)) {
                    thumb.setLayoutX(startX + frac * (endX - startX));
                }
                if (!Double.isNaN(startY)) {
                    thumb.setLayoutY(startY + frac * (endY - startY));
                }
            }
        };
        transition.play();
    } else {
        thumb.setLayoutX(endX);
        thumb.setLayoutY(endY);
    }
}
 
开发者ID:thane98,项目名称:FEFEditor,代码行数:39,代码来源:FilledSliderSkin.java

示例3: setSliderValue

import javafx.scene.control.Slider; //导入方法依赖的package包/类
@Test public void setSliderValue() {
    Slider sliderNode = (Slider) getPrimaryStage().getScene().getRoot().lookup(".slider");
    slider.marathon_select("25.0");
    new Wait("Waiting for slider value to be set.") {
        @Override public boolean until() {
            return 25.0 == sliderNode.getValue();
        }
    };
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:10,代码来源:JavaFXSliderElementTest.java

示例4: illegalArgumentException

import javafx.scene.control.Slider; //导入方法依赖的package包/类
@Test(expectedExceptions = NumberFormatException.class) public void illegalArgumentException() {
    Slider sliderNode = (Slider) getPrimaryStage().getScene().getRoot().lookup(".slider");
    slider.marathon_select("ten");
    new Wait("Waiting for slider value to be set.") {
        @Override public boolean until() {
            return 25.0 == sliderNode.getValue();
        }
    };
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:10,代码来源:JavaFXSliderElementTest.java

示例5: positionThumb

import javafx.scene.control.Slider; //导入方法依赖的package包/类
/**
 * Called when ever either min, max or value changes, so thumb's layoutX, Y is recomputed.
 */
void positionThumb(final boolean animate) {
    Slider s = getSkinnable();
    if (s.getValue() > s.getMax()) return;// this can happen if we are bound to something
    boolean horizontal = s.getOrientation() == Orientation.HORIZONTAL;
    final double endX = (horizontal) ? trackStart + (((trackLength * ((s.getValue() - s.getMin()) /
            (s.getMax() - s.getMin()))) - thumbWidth/2)) : thumbLeft;
    final double endY = (horizontal) ? thumbTop :
            snappedTopInset() + trackLength - (trackLength * ((s.getValue() - s.getMin()) /
                    (s.getMax() - s.getMin()))); //  - thumbHeight/2

    if (animate) {
        // lets animate the thumb transition
        final double startX = thumb.getLayoutX();
        final double startY = thumb.getLayoutY();
        Transition transition = new Transition() {
            {
                setCycleDuration(Duration.millis(200));
            }

            @Override protected void interpolate(double frac) {
                if (!Double.isNaN(startX)) {
                    thumb.setLayoutX(startX + frac * (endX - startX));
                }
                if (!Double.isNaN(startY)) {
                    thumb.setLayoutY(startY + frac * (endY - startY));
                }
            }
        };
        transition.play();
    } else {
        thumb.setLayoutX(endX);
        thumb.setLayoutY(endY);
    }
}
 
开发者ID:thane98,项目名称:3DSFE-Randomizer,代码行数:38,代码来源:FilledSliderSkin.java

示例6: drawNode

import javafx.scene.control.Slider; //导入方法依赖的package包/类
@Override
public Node drawNode() {
    Slider slider = createSlider(0, 100, vertical);
    slider.setValue(50);
    slider.setBlockIncrement(20);
    double new_value = slider.getValue();
    slider.adjustValue(position);
    new_value = position;
    if (Double.compare(slider.getValue(), new_value) != 0) {
        reportGetterFailure("ScrollBar.adjustValue()");
    }
    return slider;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:14,代码来源:SliderApp.java

示例7: getSliderValue

import javafx.scene.control.Slider; //导入方法依赖的package包/类
protected String getSliderValue(Slider slider) {
    return slider.getValue() + "";
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:4,代码来源:JavaFXElementPropertyAccessor.java

示例8: rotateKnob

import javafx.scene.control.Slider; //导入方法依赖的package包/类
void rotateKnob() {
    Slider s = getSkinnable();
    double zeroOneValue = (s.getValue()-s.getMin()) / (s.getMax() - s.getMin());
    double angle = minAngle + ((maxAngle-minAngle) * zeroOneValue);
    knob.setRotate(angle);
}
 
开发者ID:onebeartoe,项目名称:media-players,代码行数:7,代码来源:KnobSkin.java


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