當前位置: 首頁>>代碼示例>>Java>>正文


Java Slider.setMin方法代碼示例

本文整理匯總了Java中javafx.scene.control.Slider.setMin方法的典型用法代碼示例。如果您正苦於以下問題:Java Slider.setMin方法的具體用法?Java Slider.setMin怎麽用?Java Slider.setMin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.control.Slider的用法示例。


在下文中一共展示了Slider.setMin方法的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: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: createSlider

import javafx.scene.control.Slider; //導入方法依賴的package包/類
private Slider createSlider(){
	Slider pSlider = new Slider();
	pSlider.setShowTickLabels(true);
	pSlider.setShowTickMarks(true);
	pSlider.setSnapToTicks(true);
	pSlider.setMin(0);
	pSlider.setMax(10.0);
	pSlider.setMajorTickUnit(10.0);
	pSlider.setMinorTickCount(99);
	pSlider.setBlockIncrement(0.1);
	
	return pSlider;
}
 
開發者ID:Flash3388,項目名稱:FlashLib,代碼行數:14,代碼來源:PIDTunerWindow.java

示例8: HybridProgressbar

import javafx.scene.control.Slider; //導入方法依賴的package包/類
public HybridProgressbar() {
    progressBar = new ProgressBar();
    slider = new Slider();

    controller = new HybridProgressbarController(this);

    slider.setMin(0);
    slider.setMax(1);

    progressBar.getStyleClass().add("hybrid-pb-progress");
    slider.getStyleClass().add("hybrid-pb-slider");

    progressBar.prefWidthProperty().bind(this.widthProperty());
    progressBar.prefHeightProperty().bind(this.heightProperty().divide(10));
    slider.prefWidthProperty().bind(this.widthProperty());
    slider.prefHeightProperty().bind(this.heightProperty().divide(10));

    slider.valueProperty().addListener((observeable, oldValue, newValue) -> {
        double progress = newValue.doubleValue();
        progressBar.setProgress(progress);
    });

    slider.valueProperty().addListener(controller.sliderValueChanged);
    slider.setOnMouseReleased(controller.onMouseReleased);
    slider.setOnMouseClicked(controller.onMouseClicked);

    this.getChildren().add(progressBar);
    this.getChildren().add(slider);
}
 
開發者ID:MolaynoxX,項目名稱:amperfi,代碼行數:30,代碼來源:HybridProgressbar.java

示例9: 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;
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:11,代碼來源:SliderApp.java

示例10: TimeSlider

import javafx.scene.control.Slider; //導入方法依賴的package包/類
public TimeSlider() {
    getStyleClass().add("track");
    setFocusTraversable(true);
    setMinWidth(200);
    setMaxWidth(200);

    slider = new Slider();
    slider.setMin(0);

    progressBar = new ProgressBar(0);
}
 
開發者ID:kcpeppe,項目名稱:regions,代碼行數:12,代碼來源:TimeSlider.java

示例11: SliderProgressBar

import javafx.scene.control.Slider; //導入方法依賴的package包/類
public SliderProgressBar() {
    progressBar = new ProgressBar(0);
    progressBar.setMaxWidth(Double.MAX_VALUE);

    slider = new Slider();
    slider.setMin(0);
    slider.setMax(100);

    getChildren().addAll(progressBar, slider);
}
 
開發者ID:mpcontracting,項目名稱:rpmjukebox,代碼行數:11,代碼來源:SliderProgressBar.java

示例12: setNumericParameterValueRange

import javafx.scene.control.Slider; //導入方法依賴的package包/類
/**
 * Set the minimum and maximum value for a numeric parameter.
 * 
 * If the parameter is being displayed with a slider, the slider range will also be updated accordingly.
 * 
 * @param key
 * @param minValue
 * @param maxValue
 * @return
 */
public boolean setNumericParameterValueRange(final String key, double minValue, double maxValue) {
	// Try to get a component to set
	Parameter<?> parameterOrig = params.getParameters().get(key);
	if (parameterOrig == null || !(parameterOrig instanceof NumericParameter)) {
		logger.warn("Unable to set range for {} - no numeric parameter found with that key", key);
		return false;			
	}
	NumericParameter<?> parameter = (NumericParameter<?>)parameterOrig;
	// Occurs with hidden parameters
	try {
		parameter.setRange(minValue, maxValue);
		Node component = map.get(parameter);
		if (component instanceof Parent) {
			for (Node comp : ((Parent)component).getChildrenUnmodifiable()) {
				if (comp instanceof Slider) {
					// Only change the text if necessary
					Slider slider = (Slider)comp;
						slider.setMin(minValue);
						slider.setMax(maxValue);
						return true;
				}
			}
		}
	} catch (Exception e) {
		logger.warn("Unable to set range for {}: {}", parameter, e.getLocalizedMessage());							
	}
	return false;
}
 
開發者ID:qupath,項目名稱:qupath,代碼行數:39,代碼來源:ParameterPanelFX.java

示例13: createButtonsBox

import javafx.scene.control.Slider; //導入方法依賴的package包/類
public void createButtonsBox() {
    Region separateRegion = new Region();
    HBox.setHgrow(separateRegion, Priority.ALWAYS);
    zoomSlider = new Slider();
    zoomSlider.setMin(2);
    zoomSlider.setMax(130);
    this.getChildren().addAll(addButton, removeButton, separateRegion, zoomSlider);
}
 
開發者ID:khasang,項目名稱:Cachoeira,代碼行數:9,代碼來源:AbstractButtonsBox.java

示例14: getContent

import javafx.scene.control.Slider; //導入方法依賴的package包/類
private Parent getContent() {
      
      final Slider slider = new Slider();
      slider.setMin(0);
      slider.setMax(100);
      slider.setShowTickMarks(true);
      slider.setBlockIncrement(1);
      slider.setMajorTickUnit(1);
      slider.setSnapToTicks(true);
 
      String duration = "3000ms"; // Change this value for different speeds
      
      final Timeline timeline = new Timeline();
timeline.setCycleCount(1); 
KeyValue kv = new KeyValue(slider.valueProperty(),100);
KeyFrame kf = new KeyFrame(Duration.valueOf(duration), kv);
timeline.getKeyFrames().add(kf);

      Button button = new Button("Button");
      button.setOnAction(new EventHandler<ActionEvent>() {
          public void handle(ActionEvent t) {
              timeline.play();
          }
      });
      
      VBox vbox = new VBox(5);
      vbox.getChildren().addAll(slider, button);
      return vbox;
  }
 
開發者ID:SaiPradeepDandem,項目名稱:javafx-demos,代碼行數:30,代碼來源:SliderIncrement.java

示例15: View

import javafx.scene.control.Slider; //導入方法依賴的package包/類
/**
 * Create an instance of the View.
 */
public View() {
    setSpacing(20);
    setPadding(new Insets(20));

    final Text header = new Text("SynchronizeFX Example");
    header.setFill(Color.DIMGRAY);
    header.setStyle("-fx-font-size:24");

    slider = new Slider();
    slider.setMin(0);
    slider.setMax(100);
    slider.setShowTickLabels(true);
    slider.setShowTickMarks(true);
    slider.setMajorTickUnit(20);
    slider.setMinorTickCount(5);
    slider.setSnapToTicks(true);


    final Label valueLabel = new Label();
    valueLabel.setTextFill(Color.DIMGRAY);
    valueLabel.setStyle("-fx-font-size:15");

    valueLabel.textProperty()
            .bind(Bindings.format("Current Value: %1$.1f",
                    slider.valueProperty()));

    getChildren().addAll(header, slider, valueLabel);
}
 
開發者ID:saxsys,項目名稱:SynchronizeFX,代碼行數:32,代碼來源:View.java


注:本文中的javafx.scene.control.Slider.setMin方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。