本文整理匯總了Java中javafx.scene.control.Slider.getMax方法的典型用法代碼示例。如果您正苦於以下問題:Java Slider.getMax方法的具體用法?Java Slider.getMax怎麽用?Java Slider.getMax使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.control.Slider
的用法示例。
在下文中一共展示了Slider.getMax方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: drawNode
import javafx.scene.control.Slider; //導入方法依賴的package包/類
@Override
public Node drawNode() {
Slider slider = createSlider(min, max, vertical);
slider.setValue(value);
if (value > slider.getMax()) {
value = slider.getMax();
}
if (value < slider.getMin()) {
value = slider.getMin();
}
if (Double.compare(slider.getMin(), min) != 0) {
reportGetterFailure("Slider.getMin()");
}
if (Double.compare(slider.getMax(), max) != 0) {
reportGetterFailure("Slider.getMax()");
}
if (Double.compare(slider.getValue(), value) != 0) {
reportGetterFailure("Slider.getValue()");
}
return slider;
}
示例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);
}
}
示例3: 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);
}
}
示例4: 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);
}