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


Java JFXSlider类代码示例

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


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

示例1: start

import com.jfoenix.controls.JFXSlider; //导入依赖的package包/类
@Override
public void start(Stage stage) {
    JFXSlider horLeftSlider = new JFXSlider();
    horLeftSlider.setMinWidth(500);

    JFXSlider horRightSlider = new JFXSlider();
    horRightSlider.setMinWidth(500);
    horRightSlider.setIndicatorPosition(IndicatorPosition.RIGHT);

    JFXSlider verLeftSlider = new JFXSlider();
    verLeftSlider.setMinHeight(500);
    verLeftSlider.setOrientation(Orientation.VERTICAL);

    JFXSlider verRightSlider = new JFXSlider();
    verRightSlider.setMinHeight(500);
    verRightSlider.setOrientation(Orientation.VERTICAL);
    verRightSlider.setIndicatorPosition(IndicatorPosition.RIGHT);

    HBox hbox = new HBox();
    hbox.setSpacing(450);
    hbox.getChildren().addAll(verRightSlider, verLeftSlider);

    VBox vbox = new VBox();
    vbox.getChildren().addAll(horRightSlider, horLeftSlider, hbox);
    vbox.setSpacing(100);
    vbox.setPadding(new Insets(100, 50, 50, 150));

    Scene scene = new Scene(new Group());
    ((Group) scene.getRoot()).getChildren().add(vbox);
    scene.getStylesheets().add(SliderDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
    stage.setScene(scene);
    stage.setWidth(900);
    stage.setHeight(900);
    stage.show();
    stage.setTitle("JFX Slider Demo");

}
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:38,代码来源:SliderDemo.java

示例2: JFXSliderSkin

import com.jfoenix.controls.JFXSlider; //导入依赖的package包/类
public JFXSliderSkin(JFXSlider slider) {
    super(slider);

    track = (StackPane) getSkinnable().lookup(".track");
    thumb = (StackPane) getSkinnable().lookup(".thumb");

    coloredTrack = new StackPane();
    coloredTrack.getStyleClass().add("colored-track");
    coloredTrack.setMouseTransparent(true);

    sliderValue = new Text();
    sliderValue.getStyleClass().setAll("slider-value");

    animatedThumb = new StackPane();
    animatedThumb.getStyleClass().add("animated-thumb");
    animatedThumb.getChildren().add(sliderValue);
    animatedThumb.setMouseTransparent(true);
    animatedThumb.setScaleX(0);
    animatedThumb.setScaleY(0);

    getChildren().add(getChildren().indexOf(thumb), coloredTrack);
    getChildren().add(getChildren().indexOf(thumb), animatedThumb);
    getChildren().add(0, mouseHandlerPane);

    registerChangeListener(slider.valueFactoryProperty(), "VALUE_FACTORY");

    initListeners();
}
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:29,代码来源:JFXSliderSkin.java

示例3: refreshSliderValueBinding

import com.jfoenix.controls.JFXSlider; //导入依赖的package包/类
private void refreshSliderValueBinding() {
    sliderValue.textProperty().unbind();
    if (((JFXSlider) getSkinnable()).getValueFactory() != null) {
        sliderValue.textProperty()
            .bind(((JFXSlider) getSkinnable()).getValueFactory().call((JFXSlider) getSkinnable()));
    } else {
        sliderValue.textProperty().bind(Bindings.createStringBinding(() -> {
            if (getSkinnable().getLabelFormatter() != null) {
                return getSkinnable().getLabelFormatter().toString(getSkinnable().getValue());
            } else {
                return Math.round(getSkinnable().getValue()) + "";
            }
        }, getSkinnable().valueProperty()));
    }
}
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:16,代码来源:JFXSliderSkin.java

示例4: initializeVariables

import com.jfoenix.controls.JFXSlider; //导入依赖的package包/类
private void initializeVariables() {
    shifting = 30 + thumb.getWidth();
    if (getSkinnable().getOrientation() != Orientation.HORIZONTAL) {
        horizontalRotation = -90;
    }
    if (((JFXSlider) getSkinnable()).getIndicatorPosition() != IndicatorPosition.LEFT) {
        indicatorRotation = 180;
        shifting = -shifting;
    }
    final double rotationAngle = 45;
    sliderValue.setRotate(rotationAngle + indicatorRotation + 3 * horizontalRotation);
    animatedThumb.setRotate(-rotationAngle + indicatorRotation + horizontalRotation);
}
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:14,代码来源:JFXSliderSkin.java

示例5: initAnimation

import com.jfoenix.controls.JFXSlider; //导入依赖的package包/类
private void initAnimation(Orientation orientation) {
    double thumbPos, thumbNewPos;
    DoubleProperty layoutProperty;

    if (orientation == Orientation.HORIZONTAL) {
        if (((JFXSlider) getSkinnable()).getIndicatorPosition() == IndicatorPosition.RIGHT) {
            thumbPos = thumb.getLayoutY() - thumb.getHeight();
            thumbNewPos = thumbPos - shifting;
        } else {
            double height = animatedThumb.prefHeight(animatedThumb.prefWidth(-1));
            thumbPos = thumb.getLayoutY() - height / 2;
            thumbNewPos = thumb.getLayoutY() - height - thumb.getHeight();
        }
        layoutProperty = animatedThumb.translateYProperty();
    } else {
        if (((JFXSlider) getSkinnable()).getIndicatorPosition() == IndicatorPosition.RIGHT) {
            thumbPos = thumb.getLayoutX() - thumb.getWidth();
            thumbNewPos = thumbPos - shifting;
        } else {
            double width = animatedThumb.prefWidth(-1);
            thumbPos = thumb.getLayoutX() - width / 2;
            thumbNewPos = thumb.getLayoutX() - width - thumb.getWidth();
        }
        layoutProperty = animatedThumb.translateXProperty();
    }

    clearAnimation();

    timeline = new Timeline(
        new KeyFrame(
            Duration.ZERO,
            new KeyValue(animatedThumb.scaleXProperty(), 0, Interpolator.EASE_BOTH),
            new KeyValue(animatedThumb.scaleYProperty(), 0, Interpolator.EASE_BOTH),
            new KeyValue(layoutProperty, thumbPos, Interpolator.EASE_BOTH)),
        new KeyFrame(
            Duration.seconds(0.2),
            new KeyValue(animatedThumb.scaleXProperty(), 1, Interpolator.EASE_BOTH),
            new KeyValue(animatedThumb.scaleYProperty(), 1, Interpolator.EASE_BOTH),
            new KeyValue(layoutProperty, thumbNewPos, Interpolator.EASE_BOTH)));
}
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:41,代码来源:JFXSliderSkin.java

示例6: initBodyContent

import com.jfoenix.controls.JFXSlider; //导入依赖的package包/类
@Override
protected void initBodyContent(Pane bodyPane) throws CouldNotPerformException {
    brightnessSlider = new JFXSlider();
    brightnessSlider.valueProperty().addListener((observable) -> {
        if (isHover()) {
            try {
                recurrenceEventFilterHSV.trigger(brightnessSlider.getValue());
            } catch (CouldNotPerformException ex) {
                ExceptionPrinter.printHistory("Could not trigger brightness change!", ex, LOGGER);
            }
        }
    });
    bodyPane.getChildren().add(brightnessSlider);
}
 
开发者ID:openbase,项目名称:bco.bcozy,代码行数:15,代码来源:DimmableLightPane.java

示例7: setPrecisionSlider

import com.jfoenix.controls.JFXSlider; //导入依赖的package包/类
/**
 * @param precisionSlider the precisionSlider to set
 */
public void setPrecisionSlider(JFXSlider precisionSlider) {
	this.precisionSlider = precisionSlider;
}
 
开发者ID:goxr3plus,项目名称:XR3Capture,代码行数:7,代码来源:SettingsWindowController.java

示例8: createFXZoomSlider

import com.jfoenix.controls.JFXSlider; //导入依赖的package包/类
public void createFXZoomSlider() {
	// logger.info("MainScene's createFXZoomSlider() is on " +
	// Thread.currentThread().getName() + " Thread");

	// Set up a settlement view zoom bar
	zoomSlider = new JFXSlider();
	zoomSlider.getStyleClass().add("jfx-slider");
	// zoom.setMinHeight(100);
	// zoom.setMaxHeight(200);
	zoomSlider.prefHeightProperty().bind(mapStackPane.heightProperty().multiply(.3d));
	zoomSlider.setMin(1);
	zoomSlider.setMax(35);
	zoomSlider.setValue(DEFAULT_ZOOM);
	zoomSlider.setMajorTickUnit(34);	
	zoomSlider.setMinorTickCount(1);	
	zoomSlider.setShowTickLabels(true);
	zoomSlider.setShowTickMarks(true);
	zoomSlider.setSnapToTicks(false);
	zoomSlider.setBlockIncrement(.5);
	zoomSlider.setOrientation(Orientation.VERTICAL);
	zoomSlider.setIndicatorPosition(IndicatorPosition.RIGHT);

	setQuickToolTip(zoomSlider, Msg.getString("SettlementTransparentPanel.tooltip.zoom")); //$NON-NLS-1$
	// detect dragging on zoom scroll bar
	zoomSlider.valueProperty().addListener(new ChangeListener<Number>() {
		public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) {
			if (old_val != new_val) {
				// Change scale of map based on slider position.
				double sliderValue = new_val.doubleValue();
				//double d = SettlementMapPanel.DEFAULT_SCALE;
				double newScale = 0;
				if (sliderValue > 0) {
					newScale = sliderValue;//* SettlementTransparentPanel.ZOOM_CHANGE;
				} 
				//else if (sliderValue < 0) {
				//	newScale = 1 + sliderValue;//* SettlementTransparentPanel.ZOOM_CHANGE));
				//}
				mapPanel.setScale(newScale);
			}
		}
	});
}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:43,代码来源:MainScene.java

示例9: setStylesheet

import com.jfoenix.controls.JFXSlider; //导入依赖的package包/类
public void setStylesheet(JFXSlider s, String cssFile) {
	s.getStylesheets().clear();
	s.getStylesheets().add(getClass().getResource(cssFile).toExternalForm());
}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:5,代码来源:MainScene.java

示例10: getZoom

import com.jfoenix.controls.JFXSlider; //导入依赖的package包/类
public JFXSlider getZoom() {
	return zoomSlider;
}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:4,代码来源:MainScene.java

示例11: initContent

import com.jfoenix.controls.JFXSlider; //导入依赖的package包/类
@Override
public void initContent() {
    int counter = 0;

    if (comfort) {
        comfortSlider = new JFXSlider(0.0, 100.0, 0.0);
        comfortSlider.getStyleClass().clear();
        ObserverLabel comfortLabel = new ObserverLabel("comfort");
        comfortSlider.valueProperty().addListener((observable) -> {
            if (isHover()) {
                comfortProperty.set(comfortSlider.getValue());
            }
        });
        setConstraints(comfortLabel, 0, 0);
        setConstraints(comfortSlider, 1, 0);
        getChildren().addAll(comfortSlider, comfortLabel);
        counter++;
    }
    if (energy) {
        energySlider = new JFXSlider(0.0, 100.0, 0.0);
        energySlider.getStyleClass().clear();
        ObserverLabel energyLabel = new ObserverLabel("energy");
        energySlider.valueProperty().addListener((observable) -> {
            if (isHover()) {
                energyProperty.set(energySlider.getValue());
            }
        });
        setConstraints(energyLabel, 0, counter);
        setConstraints(energySlider, 1, counter);
        getChildren().addAll(energySlider, energyLabel);
        counter++;
    }
    if (security) {
        securitySlider = new JFXSlider(0.0, 100.0, 0.0);
        securitySlider.getStyleClass().clear();
        ObserverLabel securityLabel = new ObserverLabel("security");
        securitySlider.valueProperty().addListener((observable) -> {
            if (isHover()) {
                securityProperty.set(securitySlider.getValue());
            }
        });
        setConstraints(securityLabel, 0, counter);
        setConstraints(securitySlider, 1, counter);
        getChildren().addAll(securitySlider, securityLabel);
    }
}
 
开发者ID:openbase,项目名称:bco.bcozy,代码行数:47,代码来源:EmphasisAdjustment.java

示例12: getPrecisionSlider

import com.jfoenix.controls.JFXSlider; //导入依赖的package包/类
/**
 * Gets the precision slider.
 *
 * @return The precisionSlider
 */
public JFXSlider getPrecisionSlider() {
	return precisionSlider;
}
 
开发者ID:goxr3plus,项目名称:XR3Capture,代码行数:9,代码来源:SettingsWindowController.java


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