本文整理汇总了Java中javafx.scene.control.Slider.setOrientation方法的典型用法代码示例。如果您正苦于以下问题:Java Slider.setOrientation方法的具体用法?Java Slider.setOrientation怎么用?Java Slider.setOrientation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.Slider
的用法示例。
在下文中一共展示了Slider.setOrientation方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Son
import javafx.scene.control.Slider; //导入方法依赖的package包/类
public Son(Clavier clavier) {
this.clavier = clavier;
slider = new Slider(0, 127, 60);
slider.setOrientation(Orientation.VERTICAL);
slider.setTranslateY(35);
slider.valueProperty().addListener(new ChangeListener() {
@Override
public void changed(ObservableValue o, Object oldVal, Object newVal) {
clavier.requestFocus();
}
});
ProgressIndicator indicateur = new ProgressIndicator(0.0);
indicateur.progressProperty().bind(slider.valueProperty().divide(127.0));
indicateur.setTranslateX(-15);
this.getChildren().add(slider);
this.getChildren().add(indicateur);
this.setTranslateY(260);
this.setTranslateX(60);
}
示例2: createSlider
import javafx.scene.control.Slider; //导入方法依赖的package包/类
private Slider createSlider(double chartUpperDefault, double chartUpperBound, double chartTickUnit) {
Slider slider = new Slider();
slider.setOrientation(Orientation.VERTICAL);
slider.setMin(0);
slider.setMax(chartUpperBound);
slider.setValue(chartUpperDefault);
slider.setShowTickLabels(true);
slider.setShowTickMarks(true);
slider.setMajorTickUnit(chartTickUnit);
//slider.setMinorTickCount(0.01);
slider.setBlockIncrement(0.01);
// otherwise below, we also could delegate mediator, but in this case
// it is unnecessary because if the GUI that interacts with itself
//slider.valueProperty().addListener(mediator);
return slider;
}
示例3: createSlider
import javafx.scene.control.Slider; //导入方法依赖的package包/类
private Slider createSlider() {
Slider slider = new Slider();
slider.setOrientation(Orientation.VERTICAL);
slider.setMin(1);
slider.setMax(10);
slider.setValue(1);
slider.setShowTickLabels(true);
slider.setShowTickMarks(true);
slider.setMajorTickUnit(0.5);
//slider.setMinorTickCount(0.01);
slider.setBlockIncrement(0.01);
slider.valueProperty().addListener(new ChangeListener<Number>() {
public void changed(ObservableValue<? extends Number> ov,
Number old_val, Number new_val) {
magnificationProperty.set(new_val.doubleValue());
}
});
// otherwise below, we also could delegate mediator, but in this case
// it is unnecessary because if the GUI that interacts with itself
//slider.valueProperty().addListener(mediator);
return slider;
}
示例4: createSliderNoSizes
import javafx.scene.control.Slider; //导入方法依赖的package包/类
protected Slider createSliderNoSizes(double min, double max, boolean vertical) {
Slider slider = new Slider();
slider.setOrientation(vertical ? Orientation.VERTICAL : Orientation.HORIZONTAL);
slider.setMin(min);
slider.setMax(max);
slider.setShowTickMarks(true);
slider.setShowTickLabels(true);
slider.setStyle("-fx-border-color: darkgray");
return slider;
}
示例5: start
import javafx.scene.control.Slider; //导入方法依赖的package包/类
@SuppressWarnings("nls")
@Override
public void start(final Stage stage)
{
Slider slider = new Slider();
slider.setOrientation(Orientation.VERTICAL);
slider.setLayoutX(110);
slider.setPrefHeight(200);
slider.setValue(Double.NaN);
Rectangle rect1 = createRect(10);
rect1.setStyle("-fx-stroke-width: 1; -fx-stroke-dash-array: 5.0, 5.0; -fx-stroke: blue; -fx-fill: rgb(0, 0, 255, 0.05);");
Rectangle rect2 = createRect(30);
rect2.setStyle("-fx-stroke-width: 1; -fx-stroke: blue; -fx-fill: rgb(0, 0, 255, 0.05);");
final Pane pane = new Pane(slider, rect1, rect2);
pane.setPadding(new Insets(5));
final Label label = new Label("Drag the bottom right corner of each rectangle across the slider. When the slider value is NaN,\n"
+ "the dashed rectangle freezes the program; the solid-bordered one disappears and reappears.\n"
+ "When it is finite, the rectangles behave as expected.");
Button button = new Button("Toggle NaN/finite value.");
button.setOnAction(e->
{
slider.setValue(Double.isFinite(slider.getValue()) ? Double.NaN : 50);
});
final VBox root = new VBox(pane, label, button);
final Scene scene = new Scene(root, 800, 700);
stage.setScene(scene);
stage.setTitle("Slider Glitch Demo");
stage.show();
}
示例6: start
import javafx.scene.control.Slider; //导入方法依赖的package包/类
@Override
public void start(final Stage stage)
{
final Slider slider = new Slider();
slider.setOrientation(Orientation.HORIZONTAL);
slider.setShowTickLabels(true);
slider.setShowTickMarks(true);
slider.setMajorTickUnit(20.0);
slider.setMin(-100.0);
slider.setMax(100.0);
slider.setValue(10.0);
slider.valueProperty().addListener((observable, old, value)->
{
System.out.println("Value: " + value);
});
final SliderMarkers markers = new SliderMarkers(slider);
markers.setAlarmMarkers(-100, -10, 70, 90);
final String font = "-fx-font-size: 30px";
slider.setStyle(font);
markers.setStyle(font);
final GridPane layout = new GridPane();
layout.add(markers, 0, 0);
layout.getChildren().add(slider);
if (slider.getOrientation() == Orientation.VERTICAL)
{
GridPane.setConstraints(slider, 1, 0);
GridPane.setVgrow(slider, Priority.ALWAYS);
}
else
{
GridPane.setConstraints(slider, 0, 1);
GridPane.setHgrow(slider, Priority.ALWAYS);
}
final Scene scene = new Scene(layout, 800, 700);
stage.setScene(scene);
stage.setTitle("Slider Demo");
stage.show();
markers.update();
}