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


Java Slider.setValue方法代码示例

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


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

示例1: VisionControl

import javafx.scene.control.Slider; //导入方法依赖的package包/类
public VisionControl() {
	slider = new Slider();
	slider.setMin(0.0);
	slider.setMax(255.0);
	slider.setValue(0.0);
	slider.setMaxWidth(350.0);
	slider.setDisable(true);
	
	inputText = new TextField();
	inputText.setText("0");
	inputText.setMaxWidth(50.0);
	inputText.setOnKeyPressed((e)->{
		if(e.getCode() == KeyCode.ENTER){
			setTextFromField();
		}
	});
	inputText.focusedProperty().addListener((obs, o, n)->{
		if(!n.booleanValue()){
			inputText.setText(String.valueOf((int)slider.getValue()));
		}
	});
	
	slider.valueProperty().addListener((obs, o, n)->{
		inputText.setText(String.valueOf((int)slider.getValue()));
	});
	
	nameLabel = new Label("");
	
	HBox top = new HBox();
	top.setSpacing(5.0);
	top.getChildren().addAll(nameLabel, inputText);
	
	VBox all = new VBox();
	all.setSpacing(10.0);
	all.getChildren().addAll(top, slider);
	root = all;
}
 
开发者ID:Flash3388,项目名称:FlashLib,代码行数:38,代码来源:MainWindow.java

示例2: 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;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:22,代码来源:SliderApp.java

示例3: setSliderRange

import javafx.scene.control.Slider; //导入方法依赖的package包/类
static void setSliderRange(final Slider slider, double position, double min, double max) {
		slider.setMin(min);
		slider.setMax(max);
//		int range = (int)(max - min + 0.5);
//		if (range > 200) {
//			slider.setMajorTickUnit(50);
//			slider.setMinorTickCount(10);
//		} else if (range >= 50) {
//			slider.setMajorTickUnit(10);
//			slider.setMinorTickCount(5);
//		} else if (range >= 10) {
//			slider.setMajorTickUnit(5);
//			slider.setMinorTickCount(1);
//		} else {
//			slider.setMajorTickUnit(1);
//			slider.setMinorTickCount(1);
//		}
		slider.setMajorTickUnit(1);
		slider.setSnapToTicks(true);
		slider.setShowTickMarks(false);
		slider.setShowTickLabels(false);
		slider.setValue(position);
		slider.setOpacity(0.25);
		slider.setBlockIncrement(1.0);
		
		slider.setOnMouseEntered(e -> {
			slider.setOpacity(1);			
		});
		slider.setOnMouseExited(e -> {
			slider.setOpacity(0.5);			
		});
	}
 
开发者ID:qupath,项目名称:qupath,代码行数:33,代码来源:QuPathViewerPlus.java

示例4: 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;
}
 
开发者ID:paolopavan,项目名称:circosFX,代码行数:19,代码来源:Trials.java

示例5: 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;
}
 
开发者ID:paolopavan,项目名称:circosFX,代码行数:26,代码来源:Circos.java

示例6: addSliderControl

import javafx.scene.control.Slider; //导入方法依赖的package包/类
private Slider addSliderControl(final String title,
    final DoubleProperty prop) {
final Slider slider = new Slider();
slider.setValue(prop.get());
prop.bind(slider.valueProperty());
final VBox box = new VBox();
final Text titleText = new Text(title);

titleText.textProperty().bind(new StringBinding() {
    {
	super.bind(slider.valueProperty());
    }

    @Override
    protected String computeValue() {
	return title + " : " + twoDForm.format(slider.getValue());
    }

});
box.getChildren().addAll(titleText, slider);
getChildren().add(box);
return slider;
   }
 
开发者ID:MrLoNee,项目名称:RadialFx,代码行数:24,代码来源:DemoUtil.java

示例7: SliderSample

import javafx.scene.control.Slider; //导入方法依赖的package包/类
public SliderSample() {
    VBox root = new VBox();
    Slider slider = new Slider();
    slider.setMin(0);
    slider.setMax(100);
    slider.setValue(40);
    slider.setShowTickLabels(true);
    slider.setShowTickMarks(true);
    slider.setMajorTickUnit(50);
    slider.setMinorTickCount(5);
    slider.setBlockIncrement(10);
    root.getChildren().addAll(slider, new Button("Click me!!"));
    getChildren().add(root);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:15,代码来源:SliderSample.java

示例8: pitchChanged

import javafx.scene.control.Slider; //导入方法依赖的package包/类
@Override
public void pitchChanged(final Camera camera, final Angle pitch) {
	final Slider sliderPitch = this.sliderPitch;
	
	if(sliderPitch != null) {
		if(Platform.isFxApplicationThread()) {
			sliderPitch.setValue(pitch.degrees);
		} else {
			Platform.runLater(() -> sliderPitch.setValue(pitch.degrees));
		}
	}
}
 
开发者ID:macroing,项目名称:Dayflower-Path-Tracer,代码行数:13,代码来源:TestApplication.java

示例9: yawChanged

import javafx.scene.control.Slider; //导入方法依赖的package包/类
@Override
public void yawChanged(final Camera camera, final Angle yaw) {
	final Slider sliderYaw = this.sliderYaw;
	
	if(sliderYaw != null) {
		if(Platform.isFxApplicationThread()) {
			sliderYaw.setValue(yaw.degrees);
		} else {
			Platform.runLater(() -> sliderYaw.setValue(yaw.degrees));
		}
	}
}
 
开发者ID:macroing,项目名称:Dayflower-Path-Tracer,代码行数:13,代码来源:TestApplication.java

示例10: createSlider

import javafx.scene.control.Slider; //导入方法依赖的package包/类
@Override
public Slider createSlider (double min, double max, double start, double increment) {
    Slider slider = new Slider();
    slider.setMin(min);
    slider.setMax(max);
    slider.setValue(start);
    slider.setBlockIncrement(increment);
    slider.setShowTickLabels(true);
    slider.setShowTickMarks(true);
    return slider;
}
 
开发者ID:tomrom95,项目名称:GameAuthoringEnvironment,代码行数:12,代码来源:BasicUIFactory.java

示例11: ProgressSlider

import javafx.scene.control.Slider; //导入方法依赖的package包/类
public ProgressSlider(int minWidth, int minHeight, int maxWidth, int maxHeight) {
	progressBar = new ProgressBar();
	progressBar.setProgress(0D);
	slider = new Slider();
	slider.setValue(1);
	slider.setValue(0);
	
	if(minWidth != -1) this.setMinWidth(minWidth);
	if(maxWidth != -1) this.setMaxWidth(maxWidth);
	if(minHeight != -1) this.setMinHeight(minHeight);
	if(maxHeight != -1) this.setMaxHeight(maxHeight);
	
	progressBar.prefWidthProperty().bind(this.widthProperty());
	slider.prefWidthProperty().bind(this.widthProperty());
	slider.prefHeightProperty().bind(this.heightProperty());
	
	this.heightProperty().addListener((observeable, oldValue, newValue) -> {
		progressBar.prefHeightProperty().set(newValue.doubleValue() / 6);
	});
	
	slider.valueProperty().addListener((observeable, oldValue, newValue) -> {
		double progress = newValue.doubleValue() / slider.getMax();
		progressBar.setProgress(progress);
	});
	
	this.getChildren().add(progressBar);
	this.getChildren().add(slider);
	
	progressBar.getStyleClass().add("slider_Progress");
	slider.getStyleClass().add("slider_Slider");
}
 
开发者ID:domkog,项目名称:OcrePlayer,代码行数:32,代码来源:ProgressSlider.java

示例12: setUpSlider

import javafx.scene.control.Slider; //导入方法依赖的package包/类
/**
 * Sets up one Slider and is used multiple times to do it for more sliders. Also handles what the sliders do
 * TODO perhaps add the same parameters like setUpSpinner() to have save min and max because while the values stick to the 
 * rules of setUpSpinner it can show funny stuff if not correctly done in FXML
 * @param slider
 * @param val
 * @param pos
 */
private void setUpSlider(Slider slider, int pos, double savedSet){
	slider.setValue(savedSet);
	slider.valueProperty().addListener((observable, oldValue, newValue) -> {
   	    System.out.println("Slider Value Changed (newValue in Integer: " + newValue.intValue() + ")");
   	    setValueSettings(pos, newValue);
   	});
	
}
 
开发者ID:Raldir,项目名称:3DScanner.RaspberryPi,代码行数:17,代码来源:UIController.java

示例13: 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();
}
 
开发者ID:kasemir,项目名称:org.csstudio.display.builder,代码行数:38,代码来源:SliderGlitchDemo.java

示例14: mainScreen

import javafx.scene.control.Slider; //导入方法依赖的package包/类
private void mainScreen(final Stage primaryStage) {
    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));

    Text scenetitle = new Text("Game Of Life");
    scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    grid.add(scenetitle, 0, 0);

    Label heightLabel = new Label("Height:");
    grid.add(heightLabel, 0, 2);

    final TextField heightField = new TextField();
    heightField.setText(String.valueOf(fieldHeight));
    grid.add(heightField, 1, 2);

    Label widthLabel = new Label("Width:");
    grid.add(widthLabel, 0, 3);

    final TextField widthField = new TextField();
    widthField.setText(String.valueOf(fieldWidth));
    grid.add(widthField, 1, 3);

    Label cellDensityLabel = new Label("Cell density:");
    grid.add(cellDensityLabel, 0, 4);

    final Slider cellDensitySlider = new Slider();
    cellDensitySlider.setMin(0);
    cellDensitySlider.setMax(1);
    cellDensitySlider.setValue(cellDensity);
    cellDensitySlider.setShowTickLabels(true);
    cellDensitySlider.setShowTickMarks(true);
    cellDensitySlider.setMajorTickUnit(0.50);
    cellDensitySlider.setMinorTickCount(10);
    grid.add(cellDensitySlider, 1, 4);

    final Label errorLabel = new Label("");
    errorLabel.setMinSize(150, 10);
    grid.add(errorLabel, 0, 6);

    Button start = new Button("Start");
    start.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            try {
                fieldHeight = Integer.parseInt(heightField.getText());
                fieldWidth = Integer.parseInt(widthField.getText());
                cellDensity = cellDensitySlider.getValue();
                gameScreen(primaryStage);
            } catch (NumberFormatException e) {
                errorLabel.setText("Please enter an integer.");
            }
        }
    });
    grid.add(start,1,5);

    Scene scene = new Scene(grid);
    primaryStage.setScene(scene);
}
 
开发者ID:slemonide,项目名称:GraphSpace,代码行数:62,代码来源:Main.java

示例15: start

import javafx.scene.control.Slider; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
    System.out.println(FxIconics.getVersionName());

    Parent root = FXMLLoader.load(getClass().getResource("showroom.fxml"));
    primaryStage.setTitle("FxIconics");
    primaryStage.setScene(new Scene(root, 500, 500));
    primaryStage.show();

    Text t_fontsize = (Text) root.lookup("#t_fontsize");
    t_fontsize.setText("");

    tabPane = (TabPane) root.lookup("#tabpane");
    tabPaneWidth = tabPane.getWidth();
    tabPane.getSelectionModel().selectedIndexProperty().addListener((observable, oldValue, newValue) -> {
        lastSelectedTab = (int) newValue;
        loadTabContent(tabPane, (Integer) newValue);
    });

    tabPane.widthProperty().addListener((observable, oldValue, newValue) -> {
        tabPaneWidth = (double) newValue;
    });
    loadTabContent(tabPane, 0);

    Slider sliderSize = (Slider) root.lookup("#slider_size");
    sliderSize.valueProperty().addListener((observable, oldValue, newValue) -> {
        if (lastSliderChange + 100 < System.currentTimeMillis()) {
            lastSliderChange = System.currentTimeMillis();
            fontSize = newValue.intValue();
            t_fontsize.setText("Font size: " + fontSize);
            loadTabContent(tabPane, lastSelectedTab);
        }
    });
    sliderSize.setValue(24);

    primaryStage.widthProperty().addListener((observable, oldValue, newValue) -> {
        loadTabContent(tabPane, lastSelectedTab);
    });


    TextField tf_search = (TextField) root.lookup("#tf_search");
    tf_search.textProperty().addListener((observable, oldValue, newValue) -> {
        searchFilter = newValue;
        System.out.println(searchFilter);
        loadTabContent(tabPane, lastSelectedTab);
    });

    ToolBar toolBar = (ToolBar) root.lookup("#toolbar");

    FxIconicsButton btn_reset =
            (FxIconicsButton) new FxIconicsButton
                    .Builder(FxFontGoogleMaterial.Icons.gmd_highlight_off)
                    .size(18)
                    .text("Reset", 12)
                    .color(MaterialColor.GREY_700).build();
    btn_reset.setOnAction(event -> tf_search.setText(""));

    FxIconicsButton btn_demo =
            (FxIconicsButton) new FxIconicsButton
                    .Builder(FxFontCommunity.Icons.cmd_codepen)
                    .size(18)
                    .text("Demo", 12)
                    .color(MaterialColor.GREY_700).build();
    btn_demo.setOnAction(event -> new DialogPlayGround());

    toolBar.getItems().addAll(btn_reset, btn_demo);
}
 
开发者ID:pepperonas,项目名称:FxIconics,代码行数:68,代码来源:FxIconicsShowcase.java


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