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


Java Slider.setMajorTickUnit方法代码示例

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


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

示例1: simulationSpeedSelection

import javafx.scene.control.Slider; //导入方法依赖的package包/类
private Node simulationSpeedSelection( SimulatorSettingDetails settingDetails )
{
	VBox vBox = new VBox();

	Text simulationSpeedLabel = new Text("Simulation Speed (milliseconds / cycle)");
	simulationSpeedLabel.setId(UIConstants.TEXT_COLOR);

	//TODO take in settings for slider
	Slider simulationSpeedSlider = new Slider(0, 1000, 100);
	simulationSpeedSlider.setShowTickMarks(true);
	simulationSpeedSlider.setShowTickLabels(true);
	simulationSpeedSlider.setMajorTickUnit(100);
	simulationSpeedSlider.setBlockIncrement(100);

	simulationSpeedModel = simulationSpeedSlider.valueProperty();

	vBox.getChildren().addAll(simulationSpeedLabel, simulationSpeedSlider);

	return vBox;
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:21,代码来源:SimulatorSettingsPanel.java

示例2: criaPainelInferior

import javafx.scene.control.Slider; //导入方法依赖的package包/类
private HBox criaPainelInferior() {
	HBox hbBotoes = new HBox();
	final Button btnParar = new Button("Parar");
	final Button btnTocar = new Button("Tocar");
	final Button btnPausar = new Button("Pausar");
	final Button btnAjusta = new Button("Ajustar");
	sldTempo = new Slider(1, 10, 5);
	sldTempo.setShowTickLabels(true);
	sldTempo.setShowTickMarks(true);
	sldTempo.setMinorTickCount(1);
	sldTempo.setMajorTickUnit(1);
	hbBotoes.setAlignment(Pos.CENTER);
	hbBotoes.setSpacing(20);
	hbBotoes.getChildren().addAll(btnTocar, btnPausar, btnParar, btnAjusta, new Label("Duração (s):"), sldTempo);

	// setando as ações. Muito código gasto aqui! Poderíamos ter só uma ação
	// e setar a mesma em todos os botões ou usar os lambdas no Java 8
	btnParar.setOnAction(e -> transicaoAtual.stop());
	btnTocar.setOnAction(e -> acaoTocar(btnParar, btnTocar, btnPausar, btnAjusta));
	btnPausar.setOnAction(e -> transicaoAtual.pause());
	btnAjusta.setOnAction(e -> criaNoAlvo());
	return hbBotoes;
}
 
开发者ID:jesuino,项目名称:livro-javafx-pratico,代码行数:24,代码来源:AprendendoTransicoes.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: prepareSlider

import javafx.scene.control.Slider; //导入方法依赖的package包/类
private void prepareSlider() {
		slider = new Slider(0, nbIteration, 5);
		slider.setMajorTickUnit(nbIteration);
		slider.valueProperty().addListener((ov, oldVal, newVal) -> {
			long lNewVal = newVal.longValue();
			if(lNewVal != oldVal.longValue())
				System.out.println(lNewVal);				
		});

		slider.setBlockIncrement(1);
		slider.setSnapToTicks(true);
		if(nbIteration > Integer.MAX_VALUE) {
			slider.setMinorTickCount(Integer.MAX_VALUE);
		} else
			slider.setMinorTickCount((int) nbIteration - 1);
//		slider.setShowTickLabels(true);
//		slider.setShowTickMarks(true);
		
	}
 
开发者ID:sanke69,项目名称:fr.xs.jtk,代码行数:20,代码来源:PlayerFX.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: newSlider

import javafx.scene.control.Slider; //导入方法依赖的package包/类
public static Slider newSlider(final double min, final double max, final double value, final double blockIncrement, final double majorTickUnit, final boolean showTickLabels, final boolean showTickMarks, final boolean snapToTicks, ChangeListener<? super Number> changeListener) {
	final
	Slider slider = new Slider(min, max, value);
	slider.setBlockIncrement(blockIncrement);
	slider.setMajorTickUnit(majorTickUnit);
	slider.setShowTickLabels(showTickLabels);
	slider.setShowTickMarks(showTickMarks);
	slider.setSnapToTicks(snapToTicks);
	slider.valueProperty().addListener(changeListener);
	
	return slider;
}
 
开发者ID:macroing,项目名称:Dayflower-Path-Tracer,代码行数:13,代码来源:JavaFX.java

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

示例10: drawNode

import javafx.scene.control.Slider; //导入方法依赖的package包/类
@Override
public Node drawNode() {
    Slider slider = createSlider(0, 100, vertical);
    slider.setMajorTickUnit(distance);
    if (Double.compare(slider.getMajorTickUnit(), distance) != 0) {
        reportGetterFailure("Slider.getMajorTickUnit()");
    }
    return slider;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:10,代码来源:SliderApp.java

示例11: SliderEditor

import javafx.scene.control.Slider; //导入方法依赖的package包/类
public SliderEditor(Option<Number> option, int min, int max) {
    slider = new Slider(min, max, option.valueProperty().getValue().doubleValue());
    slider.setSnapToTicks(true);
    slider.setMajorTickUnit(1);
    slider.setMinorTickCount(0);
    valueProperty().bindBidirectional(option.valueProperty());
}
 
开发者ID:gluonhq,项目名称:gluon-samples,代码行数:8,代码来源:SettingsPresenter.java

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

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

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

import javafx.scene.control.Slider; //导入方法依赖的package包/类
private void setSlider(Slider slider, double max, int ticks){
	slider.setMax(max);
	slider.setMajorTickUnit(max);
	slider.setMinorTickCount(ticks - 1);
	slider.setBlockIncrement(max / ticks);
}
 
开发者ID:Flash3388,项目名称:FlashLib,代码行数:7,代码来源:PIDTunerWindow.java


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