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


Java Slider类代码示例

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


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

示例1: getText

import javafx.scene.control.Slider; //导入依赖的package包/类
@Test public void getText() throws Throwable {
    Slider slider = (Slider) getPrimaryStage().getScene().getRoot().lookup(".slider");
    LoggingRecorder lr = new LoggingRecorder();
    List<String> text = new ArrayList<>();
    Platform.runLater(new Runnable() {
        @Override public void run() {
            slider.setValue(25.0);
            RFXSlider rfxSlider = new RFXSlider(slider, null, null, lr);
            rfxSlider.focusLost(null);
            text.add(rfxSlider.getAttribute("text"));
        }
    });
    new Wait("Waiting for slider text.") {
        @Override public boolean until() {
            return text.size() > 0;
        }
    };
    AssertJUnit.assertEquals("25.0", text.get(0));
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:20,代码来源:RFXSliderTest.java

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

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

    }
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:25,代码来源:Son.java

示例4: start

import javafx.scene.control.Slider; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
	Slider slider = new Slider();

	BorderPane root = new BorderPane(slider);
	Button b = new Button("Start");
	root.setBottom(b);

	Scene s = new Scene(root, 800, 600);
	primaryStage.setScene(s);
	primaryStage.show();

	RController rController = ServiceUtils.getService(RControllerFactory.class).get().create(s);
	b.setOnAction(e -> {
		RNode<Node> rNode = rController.cssFirst(".slider").get();
		rNode.click();
		rNode.dragBy(Duration.ofMillis(1000), 200, 0);
	});
}
 
开发者ID:BestSolution-at,项目名称:FX-Test,代码行数:20,代码来源:SampleDrag.java

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

示例6: seiInitState

import javafx.scene.control.Slider; //导入依赖的package包/类
public void seiInitState(final Pane pane, final Button buttonToOpen, final Button btn_play_video,
                         final Button btn_stop_video, final Button btn_pause_video, final Slider time_slider,
                         final Slider volume_audio_slider, final Label time_lbl) {
    buttonToOpen.setOnAction(action -> {
        final File singleFileFromOpenedDialog = getFileChooserForVideo(primaryStage);
        if (singleFileFromOpenedDialog != null) {
            try {
                readFileAndSetInitialStateForVideoItem(singleFileFromOpenedDialog, pane);
                setupControlButtons(btn_play_video, btn_stop_video, btn_pause_video);
                setupTimeSliderDependsOnMediaPlayer(time_slider, time_lbl);
                setupVolumeSliderDependsOnMediaPlayer(volume_audio_slider);
            } catch (IOException e1) {
                LOGGER.error("An error: \n" + e1.getCause());
            }
        }
    });

}
 
开发者ID:Evegen55,项目名称:main_carauto_board,代码行数:19,代码来源:VideoController.java

示例7: MagicTabController

import javafx.scene.control.Slider; //导入依赖的package包/类
public MagicTabController(final Stage primaryStage, final Button btnOpenCVStartCamera, final CheckBox grayscale,
                          final ComboBox<RecognizingTypeOfDetection> comboBoxForTypeOfDetection,
                          final ComboBox<RecognizingTypeOfClassifier> comboBoxForTypeOfClassifier,
                          final HBox hboxHidden1, final VBox vboxHidden2, final HBox hboxHidden3, final CheckBox canny,
                          final Slider threshold, final CheckBox dilateErode, final CheckBox inverse,
                          final Button btnActivateCamera, final Button btnOpenCVWriteVideo) {
    this.primaryStage = primaryStage;
    this.btnOpenCVStartCamera = btnOpenCVStartCamera;
    this.comboBoxForTypeOfDetection = comboBoxForTypeOfDetection;
    this.comboBoxForTypeOfClassifier = comboBoxForTypeOfClassifier;
    this.checkBoxGrayscale = grayscale;

    //edge detection and hide unappropriated functionality
    this.hboxHidden1 = hboxHidden1;
    this.vboxHidden2 = vboxHidden2;
    this.hboxHidden3 = hboxHidden3;
    this.canny = canny;
    this.threshold = threshold;
    this.dilateErode = dilateErode;
    this.inverse = inverse;
    this.btnActivateCamera = btnActivateCamera;

    //write video with OpenCV
    this.btnOpenCVWriteVideo = btnOpenCVWriteVideo;
}
 
开发者ID:Evegen55,项目名称:main_carauto_board,代码行数:26,代码来源:MagicTabController.java

示例8: initializeZoom

import javafx.scene.control.Slider; //导入依赖的package包/类
/**
 * Initializes the zoom slider which affects the magnification of the authoring environment.
 */
private void initializeZoom () {
    Slider zoomControl = new Slider(SLIDER_MIN, SLIDER_MAX, SLIDER_INCREMENT);
    Text coordinateDisplay = new CustomText("");
    contentPane.setOnMouseMoved(e -> {
        String xCoordinate =
                new BigDecimal(e.getX() - width * RESIZE_FACTOR)
                        .setScale(INT_RESIZE_FACTOR, RoundingMode.HALF_UP)
                        .toString();
        String yCoordinate =
                new BigDecimal(e.getY() - height * RESIZE_FACTOR)
                        .setScale(INT_RESIZE_FACTOR, RoundingMode.HALF_UP)
                        .toString();
        coordinateDisplay.setText(String.format("X: %s   Y: %s", xCoordinate, yCoordinate));
    });
    zoomBar.getItems().addAll(zoomControl, coordinateDisplay);
    zoomControl.valueProperty().addListener( (obs, old, n) -> {
        contentPane.setScaleX((double) n);
        contentPane.setScaleY((double) n);
    });
}
 
开发者ID:sjain28,项目名称:Game-Engine-Vooga,代码行数:24,代码来源:DesignBoard.java

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

示例10: simpleValueSettingTest

import javafx.scene.control.Slider; //导入依赖的package包/类
@Smoke
@Test(timeout = 300000)
public void simpleValueSettingTest() throws InterruptedException {
    assertEquals((new Slider()).valueProperty().getValue(), 0, ASSERT_CMP_PRECISION);//initial value

    setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefWidth, 100);
    setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.value, 70);
    checkTextFieldValue(Properties.value, 70);

    testedControl.mouse().click(1, new Point(testedControl.getClickPoint()).translate(-1, 0));
    checkTextFieldValue(Properties.value, 50);

    testedControl.keyboard().pushKey(KeyboardButtons.END);
    checkTextFieldValue(Properties.value, 100);

    testedControl.keyboard().pushKey(KeyboardButtons.HOME);
    checkTextFieldValue(Properties.value, 0);

    setPropertyBySlider(SettingType.UNIDIRECTIONAL, Properties.value, 30);
    checkTextFieldValue(Properties.value, 30);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:22,代码来源:SliderTest.java

示例11: maxPropertyTest

import javafx.scene.control.Slider; //导入依赖的package包/类
@Smoke
@Test(timeout = 300000)
public void maxPropertyTest() throws InterruptedException {
    assertEquals((new Slider()).maxProperty().getValue(), 100, ASSERT_CMP_PRECISION);//initial value

    setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.max, -10);
    checkTextFieldValue(Properties.value, -10);
    checkTextFieldValue(Properties.min, -10);
    checkTextFieldValue(Properties.max, -10);

    setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.max, 150);
    setSliderPosition(TESTED_SLIDER_ID, 130, SettingOption.MANUAL);
    checkTextFieldValue(Properties.value, 130);

    testedControl.keyboard().pushKey(KeyboardButtons.END);
    checkTextFieldValue(Properties.value, 150);

    setPropertyBySlider(SettingType.UNIDIRECTIONAL, Properties.max, 30);
    checkTextFieldValue(Properties.min, -10);
    checkTextFieldValue(Properties.max, 30);
    checkTextFieldValue(Properties.value, 30);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:23,代码来源:SliderTest.java

示例12: minPropertyTest

import javafx.scene.control.Slider; //导入依赖的package包/类
@Smoke
@Test(timeout = 300000)
public void minPropertyTest() throws InterruptedException {
    assertEquals((new Slider()).minProperty().getValue(), 0, ASSERT_CMP_PRECISION);//initial value

    setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.min, 150);
    checkTextFieldValue(Properties.value, 150);
    checkTextFieldValue(Properties.min, 150);
    checkTextFieldValue(Properties.max, 150);

    setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.min, 100);
    setSliderPosition(TESTED_SLIDER_ID, 100, SettingOption.MANUAL);
    checkTextFieldValue(Properties.value, 100);

    setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.min, -100);
    requestFocusOnControl(testedControl);
    testedControl.keyboard().pushKey(KeyboardButtons.HOME);
    checkTextFieldValue(Properties.value, -100);

    setPropertyBySlider(SettingType.UNIDIRECTIONAL, Properties.min, -50);
    checkTextFieldValue(Properties.min, -50);
    checkTextFieldValue(Properties.value, 100);//100, because initial value of slider in unidirectional binding is 100.
    checkTextFieldValue(Properties.max, 150);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:25,代码来源:SliderTest.java

示例13: minorTickCountTest

import javafx.scene.control.Slider; //导入依赖的package包/类
@Smoke
@Test(timeout = 300000)//Should fail.
public void minorTickCountTest() throws InterruptedException {
    assertEquals((new Slider()).minorTickCountProperty().getValue(), 3, ASSERT_CMP_PRECISION);//initial value test

    setPropertyByToggleClick(SettingType.UNIDIRECTIONAL, Properties.snapToTicks);
    setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.majorTickUnit, 100);

    setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.minorTickCount, 1);
    setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.value, 65);
    checkTextFieldValue(Properties.value, 50);

    setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.minorTickCount, 3);
    setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.value, 15);
    checkTextFieldValue(Properties.value, 25);

    setPropertyBySlider(SettingType.UNIDIRECTIONAL, Properties.minorTickCount, 19);
    setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.value, 35);
    checkTextFieldValue(Properties.value, 35);

    setPropertyBySlider(SettingType.UNIDIRECTIONAL, Properties.minorTickCount, -5);
    setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.value, 19);
    checkTextFieldValue(Properties.value, 19);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:25,代码来源:SliderTest.java

示例14: Sliders_BLOCK_INCREMENT

import javafx.scene.control.Slider; //导入依赖的package包/类
/**
 *
 * Test slider with css : -fx-block-increment
 */
@Test
public void Sliders_BLOCK_INCREMENT() throws InterruptedException {
    testAdditionalAction(Sliders.name(), "BLOCK-INCREMENT", false);
    Wrap<? extends Scene> scene = Root.ROOT.lookup(Scene.class).wrap();
    Assert.assertNotNull(scene);
    Parent<Node> sceneParent = scene.as(Parent.class, Node.class);
    Assert.assertNotNull(sceneParent);
    final Wrap<? extends Slider> slider = sceneParent.lookup(Slider.class).wrap();
    Assert.assertNotNull(slider);
    Assert.assertEquals(slider.getControl().getValue(), 20.0, 0);
    Wrap track = sceneParent.lookup(new ByStyleClass<Node>("track")).wrap();
    slider.mouse().click(1, new Point(track.getClickPoint().x, slider.getScreenBounds().getHeight() / 2));
    slider.keyboard().pushKey(Keyboard.KeyboardButtons.LEFT);
    Assert.assertEquals(TestUtil.isEmbedded()?(int)0.0:0.0, TestUtil.isEmbedded()?(int)slider.getControl().getValue():slider.getControl().getValue(), 0);
    slider.keyboard().pushKey(Keyboard.KeyboardButtons.RIGHT);
    Assert.assertEquals(TestUtil.isEmbedded()?(int)50.0:50.0, TestUtil.isEmbedded()?(int)slider.getControl().getValue():slider.getControl().getValue(), 0);
    slider.keyboard().pushKey(Keyboard.KeyboardButtons.RIGHT);
    Assert.assertEquals(TestUtil.isEmbedded()?(int)100.0:100.0, TestUtil.isEmbedded()?(int)slider.getControl().getValue():slider.getControl().getValue(), 0);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:24,代码来源:SlidersCssTest.java

示例15: ImageGenerator

import javafx.scene.control.Slider; //导入依赖的package包/类
public ImageGenerator() {
    TextField[] fields = new TextField[] {(TextField) Components.imageSize[1], (TextField) Components.imageSize[2], (TextField) Components.shadowLength[1]};
    for(TextField field : fields) {
        Validate.removeError(field);
        if(!Validate.isNumber(field)) {
            error = true;
            Validate.addError(field);
        }
    }

    if(error) return;

    this.width = Integer.parseInt(fields[0].getText());
    this.height = Integer.parseInt(fields[1].getText());
    this.length = Integer.parseInt(fields[2].getText());
    javafx.scene.paint.Color color = ((ColorPicker) Components.backgroundColors[1]).getValue();
    this.color = new Color((float) color.getRed(), (float) color.getGreen(), (float) color.getBlue());
    this.fading = ((CheckBox) Components.fading[1]).isSelected();
    this.opacity = (float) ((Slider) Components.shadowOpacity[1]).getValue() / 100;
}
 
开发者ID:iAmGio,项目名称:FlatImages,代码行数:21,代码来源:ImageGenerator.java


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