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


Java Slider.setPrefWidth方法代碼示例

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


在下文中一共展示了Slider.setPrefWidth方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: FanOptionPane

import javafx.scene.control.Slider; //導入方法依賴的package包/類
public FanOptionPane()
{
    super();
    super.getStyleClass().add("hbox");
    super.setPadding(new Insets(10,10,10,10));
    super.setSpacing(10);
    
    speedSlider = new Slider(10, 100, InstanceProvider.getFanManager().getManaulSpeed());
    speedSlider.setPrefWidth(435);
    speedSlider.valueProperty().addListener(new SpeedSliderListener());
    
    Space sep = new Space();
    sep.setMinWidth(3);
    sep.setMaxWidth(3);
    sep.setMinHeight(25);
    sep.setMaxHeight(25);
    
    modes = new ComboBox<>(FXCollections.observableArrayList("Auto", "Manual"));
    modes.getSelectionModel().selectedItemProperty().addListener(new ModeHandler());
    modes.getSelectionModel().select(InstanceProvider.getFanModeController().getCurrentValue());
    
    modeBox = new HBox();
    modeBox.setSpacing(8);
    modeBox.getChildren().addAll(new Label("Fan Mode:"), modes);
    
    speedBox = new HBox();
    speedBox.setSpacing(8);
    speedBox.getChildren().addAll(sep, new Label("Manual Speed:"), speedSlider);
    
    super.getChildren().addAll(modeBox, speedBox);
    
}
 
開發者ID:BlueGoliath,項目名稱:Goliath-Overclocking-Utility-FX,代碼行數:33,代碼來源:FanOptionPane.java

示例2: SoundPlayer

import javafx.scene.control.Slider; //導入方法依賴的package包/類
/**
 * Creates: a new sound player
 */
public SoundPlayer() {
	play = new ToggleButton(PLAY);
	play.selectedProperty().addListener((s, o, n) -> {
		// If we have a player
		if (player != null) {
			if (n.booleanValue()) {
				play.setText(PAUSE);
				player.play();
			} else {
				play.setText(PLAY);
				player.pause();
			}
		} else {
			play.setSelected(false);
		}
	});
	play.setFont(fontAwesome);
	play.setPrefWidth(MEDIUM_WIDTH);
	getChildren().add(play);
	HBox.setHgrow(play, Priority.NEVER);
	Label mute = new Label("\uf026");
	Label loud = new Label("\uf028");
	mute.setFont(fontAwesome);
	loud.setFont(fontAwesome);
	mute.setPrefWidth(SMALL_WIDTH);
	loud.setPrefWidth(SMALL_WIDTH);
	volume = new Slider(0, 1, 1);
	volume.setPrefWidth(BIG_WIDTH);
	mute.setAlignment(Pos.BASELINE_RIGHT);
	getChildren().add(mute);
	getChildren().add(volume);
	getChildren().add(loud);

	passed = new Label("00:00");
	passed.setAlignment(Pos.BASELINE_RIGHT);
	remaining = new Label("00:00");
	passed.setPrefWidth(MEDIUM_WIDTH);
	remaining.setPrefWidth(MEDIUM_WIDTH);
	progress = new ProgressBar(0);
	progress.setMaxWidth(Double.MAX_VALUE);
	getChildren().add(passed);
	HBox.setHgrow(passed, Priority.NEVER);
	getChildren().add(progress);
	HBox.setHgrow(progress, Priority.ALWAYS);
	getChildren().add(remaining);
	HBox.setHgrow(remaining, Priority.NEVER);
	setAlignment(Pos.CENTER_LEFT);
	setSpacing(10);
	setMaxHeight(USE_PREF_SIZE);
	setPadding(new Insets(10));
	clear();
}
 
開發者ID:orangeturtle739,項目名稱:Grow,代碼行數:56,代碼來源:SoundPlayer.java

示例3: turtleSpeedSlider

import javafx.scene.control.Slider; //導入方法依賴的package包/類
private VBox turtleSpeedSlider () {
    VBox container = new VBox();

    HBox row = new HBox();

    final Slider slider = new Slider(1, 1000, 50);

    slider.setPrefWidth(400);

    Label text = new Label(Integer.toString((int) slider.getValue()));

    slider.valueProperty().addListener( (obs, old, newValue) -> {
        long speed = Math.round((double) newValue);
        text.setText(Long.toString(speed));
        
        view.setTurtleSpeed(25000/((double) newValue));

    });

    row.getChildren().addAll(slider, text);

    container.getChildren().addAll(new Label("Select turtle speed"),
                                   row);

    return container;
}
 
開發者ID:adisrini,項目名稱:slogo,代碼行數:27,代碼來源:Preferences.java

示例4: MediaBar

import javafx.scene.control.Slider; //導入方法依賴的package包/類
public MediaBar() {
    setAlignment(Pos.CENTER);
    setPadding(new Insets(5, 10, 5, 10));
    setSpacing(10);

    Label timeLabel = new Label("Time: ");
    Label volumeLabel = new Label("Vol: ");

    playButton = new Button(">");
    playButton.setOnAction(event -> {
        switch (status) {
            case PAUSED:
                registeredEventHandler.play();
                break;
            case PLAYING:
                registeredEventHandler.pause();
                break;
        }
    });

    timeSlider = new Slider();
    setHgrow(timeSlider, Priority.ALWAYS);
    timeSlider.setMinWidth(50);
    timeSlider.setMaxWidth(Double.MAX_VALUE);
    timeSlider.setOnMouseReleased(event -> registeredEventHandler.timeSliderReleased(timeSlider.getValue()));

    elapsedTimeLabel = new Label("00:00/00:00");
    elapsedTimeLabel.setMinWidth(50);
    setMargin(elapsedTimeLabel, new Insets(0, 15, 0, 0));

    volumeSlider = new Slider();
    volumeSlider.setPrefWidth(70);
    volumeSlider.setMaxWidth(Region.USE_PREF_SIZE);
    volumeSlider.setMinWidth(30);

    volumeSlider.valueProperty().addListener((observable, oldValue, newValue) -> {
        registeredEventHandler.volumeSliderChanged(oldValue.doubleValue(), newValue.doubleValue(), volumeSlider.isPressed());
    });

    getChildren().addAll(
            playButton,
            timeLabel,
            timeSlider,
            elapsedTimeLabel,
            volumeLabel,
            volumeSlider);
}
 
開發者ID:NoahAndrews,項目名稱:SynchronizedMediaPlayer,代碼行數:48,代碼來源:MediaBar.java


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