當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。