javafx.scene.control.Slider Java Examples

The following examples show how to use javafx.scene.control.Slider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ContentZoomPane.java    From JavaFXSmartGraph with MIT License 6 votes vote down vote up
private Node createSlider() {

        Slider slider = new Slider(MIN_SCALE, MAX_SCALE, MIN_SCALE);
        slider.setOrientation(Orientation.VERTICAL);
        slider.setShowTickMarks(true);
        slider.setShowTickLabels(true);
        slider.setMajorTickUnit(SCROLL_DELTA);
        slider.setMinorTickCount(1);
        slider.setBlockIncrement(0.125f);
        slider.setSnapToTicks(true);

        Text label = new Text("Zoom");

        VBox paneSlider = new VBox(slider, label);

        paneSlider.setPadding(new Insets(10, 10, 10, 10));
        paneSlider.setSpacing(10);

        slider.valueProperty().bind(this.scaleFactorProperty());

        return paneSlider;
    }
 
Example #2
Source File: ControlIntensity.java    From helloiot with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Node constructContent() {
    VBox vboxroot = new VBox();
    vboxroot.setSpacing(10.0);
    
    action = new Button();
    action.setContentDisplay(ContentDisplay.TOP);
    action.setFocusTraversable(false);
    action.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    action.setMnemonicParsing(false);
    action.getStyleClass().add("buttonbase");
    VBox.setVgrow(action, Priority.SOMETIMES);
    action.setOnAction(this::onAction);
    
    slider = new Slider();
    slider.setFocusTraversable(false);
    slider.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    slider.setPrefWidth(20.0);
    
    vboxroot.getChildren().addAll(action, slider);
    
    initialize();
    return vboxroot;
}
 
Example #3
Source File: UIFactory.java    From mcaselector with MIT License 6 votes vote down vote up
public static TextField attachTextFieldToSlider(Slider slider) {
	TextField sliderValue = new TextField();
	sliderValue.getStyleClass().add("slider-value-field");
	sliderValue.textProperty().addListener((l, o, n) -> {
		if (!n.matches("\\d*")) {
			sliderValue.setText(n.replaceAll("[^\\d]", ""));
		} else if ("".equals(n)) {
			slider.setValue(slider.getMin());
		} else {
			slider.setValue(Integer.parseInt(n));
		}
	});
	sliderValue.focusedProperty().addListener((l, o, n) -> {
		if (!n) {
			sliderValue.setText((int) slider.getValue() + "");
		}
	});
	slider.valueProperty().addListener((l, o, n) -> {
		if (n.intValue() != slider.getMin() || slider.isFocused()) {
			sliderValue.setText(n.intValue() + "");
		}
	});
	sliderValue.setText((int) slider.getValue() + "");
	return sliderValue;
}
 
Example #4
Source File: TimeSliderGUIPluginView.java    From AILibs with GNU Affero General Public License v3.0 6 votes vote down vote up
public TimeSliderGUIPluginView(final TimeSliderGUIPluginModel model) {
	super (model, new VBox());
	Platform.runLater(() -> {
		VBox timestepSliderLayout = this.getNode();
		timestepSliderLayout.setAlignment(Pos.CENTER);

		this.timestepSlider = new Slider(0, 1, 0);
		this.timestepSlider.setShowTickLabels(false);
		this.timestepSlider.setShowTickMarks(false);

		this.timestepSlider.setOnMouseReleased(event -> this.handleInputEvent());
		this.timestepSlider.setOnKeyPressed(event -> this.handleInputEvent());
		this.timestepSlider.setOnKeyReleased(event -> this.handleInputEvent());
		timestepSliderLayout.getChildren().add(this.timestepSlider);

		Label timestepSliderLabel = new Label("Timestep");
		timestepSliderLayout.getChildren().add(timestepSliderLabel);
	});
}
 
Example #5
Source File: SpeedSliderGUIPluginView.java    From AILibs with GNU Affero General Public License v3.0 6 votes vote down vote up
public SpeedSliderGUIPluginView(final SpeedSliderGUIPluginModel model) {
	super (model, new VBox());
	Platform.runLater(() -> {
		VBox visualizationSpeedSliderLayout = this.getNode();
		visualizationSpeedSliderLayout.setAlignment(Pos.CENTER);

		this.visualizationSpeedSlider = new Slider(1, 100, this.getModel().getCurrentSpeedPercentage());
		this.visualizationSpeedSlider.setShowTickLabels(true);
		this.visualizationSpeedSlider.setShowTickMarks(true);
		this.visualizationSpeedSlider.setMajorTickUnit(5);
		this.visualizationSpeedSlider.setMinorTickCount(1);

		this.visualizationSpeedSlider.setOnMouseReleased(event -> this.handleInputEvent());
		this.visualizationSpeedSlider.setOnKeyPressed(event -> this.handleInputEvent());
		this.visualizationSpeedSlider.setOnKeyReleased(event -> this.handleInputEvent());

		visualizationSpeedSliderLayout.getChildren().add(this.visualizationSpeedSlider);

		Label visualizationSpeedSliderLabel = new Label("Visualization Speed (%)");
		visualizationSpeedSliderLayout.getChildren().add(visualizationSpeedSliderLabel);
	});
}
 
Example #6
Source File: PercentSliderControl.java    From Quelea with GNU General Public License v3.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void initializeParts() {
    super.initializeParts();

    fieldLabel = new Label(field.labelProperty().getValue());

    valueLabel = new Label((int) (100 * field.getValue()) + "%");

    slider = new Slider();
    slider.setMin(min);
    slider.setMax(max);
    slider.setShowTickLabels(false);
    slider.setShowTickMarks(false);
    slider.setValue(field.getValue());

    node = new HBox();
    node.getStyleClass().add("double-slider-control");
}
 
Example #7
Source File: RFXSliderTest.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@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));
}
 
Example #8
Source File: SliderMarkers.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
public SliderMarkers(final Slider slider)
{
    this.slider = slider;

    Color color = JFXUtil.convert(WidgetColorService.getColor(NamedWidgetColors.ALARM_MAJOR));
    lolo_label.setTextFill(color);
    hihi_label.setTextFill(color);
    color = JFXUtil.convert(WidgetColorService.getColor(NamedWidgetColors.ALARM_MINOR));
    low_label.setTextFill(color);
    high_label.setTextFill(color);

    getChildren().addAll(hihi_label, high_label, low_label, lolo_label);

    // Need to update the markers whenever the slider is resized
    slider.widthProperty().addListener(width -> update());
    slider.heightProperty().addListener(height -> update());
    // .. or when the min/max changes
    slider.minProperty().addListener(min -> update());
    slider.maxProperty().addListener(max -> update());
    // Also need to update when the slider's font or knob size change,
    // but there is no obvious listener for that.
}
 
Example #9
Source File: IntegerSliderControl.java    From PreferencesFX with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void initializeParts() {
  super.initializeParts();

  fieldLabel = new Label(field.labelProperty().getValue());

  valueLabel = new Label(String.valueOf(field.getValue().intValue()));

  slider = new Slider();
  slider.setMin(min);
  slider.setMax(max);
  slider.setShowTickLabels(false);
  slider.setShowTickMarks(false);
  slider.setValue(field.getValue());

  node = new HBox();
  node.getStyleClass().add("integer-slider-control");
}
 
Example #10
Source File: DoubleSliderControl.java    From PreferencesFX with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void initializeParts() {
  super.initializeParts();

  fieldLabel = new Label(field.labelProperty().getValue());

  valueLabel = new Label(String.valueOf(field.getValue().doubleValue()));

  slider = new Slider();
  slider.setMin(min);
  slider.setMax(max);
  slider.setShowTickLabels(false);
  slider.setShowTickMarks(false);
  slider.setValue(field.getValue());

  node = new HBox();
  node.getStyleClass().add("double-slider-control");
}
 
Example #11
Source File: TestbedSidePanel.java    From jbox2d with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void stateChanged(Control control) {
  TestbedSetting setting = getClientProperty(control, SETTING_TAG);

  switch (setting.constraintType) {
    case BOOLEAN:
      CheckBox box = (CheckBox) control;
      setting.enabled = box.isSelected();
      break;
    case RANGE:
      Slider slider = (Slider) control;
      setting.value = (int) slider.getValue();
      Label label = getClientProperty(slider, LABEL_TAG);
      label.setText(setting.name + ": " + setting.value);
      break;
  }
  model.getPanel().grabFocus();
}
 
Example #12
Source File: DemoUtil.java    From RadialFx with GNU Lesser General Public License v3.0 6 votes vote down vote up
private Slider addSliderControl(final String title,
    final DoubleProperty prop) {
final Slider slider = new Slider();
slider.setValue(prop.get());
prop.bind(slider.valueProperty());
final VBox box = new VBox();
final Text titleText = new Text(title);

titleText.textProperty().bind(new StringBinding() {
    {
	super.bind(slider.valueProperty());
    }

    @Override
    protected String computeValue() {
	return title + " : " + twoDForm.format(slider.getValue());
    }

});
box.getChildren().addAll(titleText, slider);
getChildren().add(box);
return slider;
   }
 
Example #13
Source File: HideVisualisation.java    From constellation with Apache License 2.0 6 votes vote down vote up
public HideVisualisation(final AbstractHideTranslator<? extends AnalyticResult<?>, C> translator) {
    this.translator = translator;

    this.hideSlider = new Slider(0.0, 1.0, 0.0);
    hideSlider.setId("hide-visualisation-slider");
    hideSlider.setDisable(true);
    hideSlider.valueProperty().addListener((observable, oldValue, newValue) -> {
        translator.executePlugin(false, newValue.floatValue());
    });

    this.hideButton = new ToggleButton("Hide");
    hideButton.setId("hide-visualisation-button");
    hideButton.setOnAction(event -> {
        final boolean reset = !hideButton.isSelected();
        final float threshold = (float) hideSlider.getValue();
        translator.executePlugin(reset, threshold);
        hideSlider.setDisable(reset);
    });

    this.hidePanel = new HBox(5.0, hideButton, hideSlider);
}
 
Example #14
Source File: SliderGlitchDemo.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
@SuppressWarnings("nls")
@Override
public void start(final Stage stage)
{
    Slider slider = new Slider();
    slider.setOrientation(Orientation.VERTICAL);
    slider.setLayoutX(110);
    slider.setPrefHeight(200);
    slider.setValue(Double.NaN);

    Rectangle rect1 = createRect(10);
    rect1.setStyle("-fx-stroke-width: 1; -fx-stroke-dash-array: 5.0, 5.0; -fx-stroke: blue; -fx-fill: rgb(0, 0, 255, 0.05);");

    Rectangle rect2 = createRect(30);
    rect2.setStyle("-fx-stroke-width: 1; -fx-stroke: blue; -fx-fill: rgb(0, 0, 255, 0.05);");

    final Pane pane = new Pane(slider, rect1, rect2);
    pane.setPadding(new Insets(5));

    final Label label = new Label("Drag the bottom right corner of each rectangle across the slider. When the slider value is NaN,\n"
            + "the dashed rectangle freezes the program; the solid-bordered one disappears and reappears.\n"
            + "When it is finite, the rectangles behave as expected.");
    
    Button button = new Button("Toggle NaN/finite value.");
    button.setOnAction(e->
    {
        slider.setValue(Double.isFinite(slider.getValue()) ? Double.NaN : 50);
    });

    final VBox root = new VBox(pane, label, button);
    final Scene scene = new Scene(root, 800, 700);

    stage.setScene(scene);
    stage.setTitle("Slider Glitch Demo");

    stage.show();
}
 
Example #15
Source File: CustomSliderSkin.java    From MusicPlayer with MIT License 5 votes vote down vote up
/**
 * Called when ever either min, max or value changes, so thumb's layoutX, Y is recomputed.
 */
private void positionThumb(final boolean animate) {
    Slider s = getSkinnable();
    if (s.getValue() > s.getMax()) return;// this can happen if we are bound to something 
    boolean horizontal = s.getOrientation() == Orientation.HORIZONTAL;
    final double endX = (horizontal) ? trackStart + (((trackLength * ((s.getValue() - s.getMin()) /
            (s.getMax() - s.getMin()))) - thumbWidth/2)) : thumbLeft;
    final double endY = (horizontal) ? thumbTop :
        snappedTopInset() + trackLength - (trackLength * ((s.getValue() - s.getMin()) /
            (s.getMax() - s.getMin()))); //  - thumbHeight/2
    
    if (animate) {
        // lets animate the thumb transition
        final double startX = thumb.getLayoutX();
        final double startY = thumb.getLayoutY();
        Transition transition = new Transition() {
            {
                setCycleDuration(Duration.millis(200));
            }

            @Override protected void interpolate(double frac) {
                if (!Double.isNaN(startX)) {
                    thumb.setLayoutX(startX + frac * (endX - startX));
                }
                if (!Double.isNaN(startY)) {
                    thumb.setLayoutY(startY + frac * (endY - startY));
                }
            }
        };
        transition.play();
    } else {
        thumb.setLayoutX(endX);
        thumb.setLayoutY(endY);
    }
}
 
Example #16
Source File: CustomSliderSkin.java    From MusicPlayer with MIT License 5 votes vote down vote up
public CustomSliderSkin(Slider slider) {
    super(slider, new SliderBehavior(slider));

    initialize();
    slider.requestLayout();
    registerChangeListener(slider.minProperty(), "MIN");
    registerChangeListener(slider.maxProperty(), "MAX");
    registerChangeListener(slider.valueProperty(), "VALUE");
    registerChangeListener(slider.orientationProperty(), "ORIENTATION");
    registerChangeListener(slider.showTickMarksProperty(), "SHOW_TICK_MARKS");
    registerChangeListener(slider.showTickLabelsProperty(), "SHOW_TICK_LABELS");
    registerChangeListener(slider.majorTickUnitProperty(), "MAJOR_TICK_UNIT");
    registerChangeListener(slider.minorTickCountProperty(), "MINOR_TICK_COUNT");
    registerChangeListener(slider.labelFormatterProperty(), "TICK_LABEL_FORMATTER");
}
 
Example #17
Source File: SettingsPresenter.java    From gluon-samples with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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());
}
 
Example #18
Source File: CustomSliderSkin.java    From MusicPlayer with MIT License 5 votes vote down vote up
@Override protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) {
    final Slider s = getSkinnable();
    if (s.getOrientation() == Orientation.HORIZONTAL) {
        if(showTickMarks) {
            return Math.max(140, tickLine.prefWidth(-1));
        } else {
            return 140;
        }
    } else {
        return leftInset + Math.max(thumb.prefWidth(-1), track.prefWidth(-1)) +
        ((showTickMarks) ? (trackToTickGap+tickLine.prefWidth(-1)) : 0) + rightInset;
    }
}
 
Example #19
Source File: ReplayController.java    From clarity-analyzer with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public ReplayController(Slider slider) {
    this.slider = slider;
    slider.maxProperty().bind(lastTick);
    playing.addListener(this::playingStateChanged);
    slider.valueProperty().addListener(this::sliderValueChanged);
    tick.addListener(this::tickChanged);
    Main.primaryStage.setOnCloseRequest(event -> haltIfRunning());
}
 
Example #20
Source File: UiNoiseGrid.java    From EWItool with GNU General Public License v3.0 5 votes vote down vote up
UiNoiseGrid( EWI4000sPatch editPatch, MidiHandler midiHandler ) {
  
  setId( "editor-grid" );
  
  Label mainLabel = new Label( "Noise" );
  mainLabel.setId( "editor-section-label" );
  add( mainLabel, 0, 0 );
  
  timeSlider = new Slider( 0.0, 127.0, 0.0 );
  timeSlider.setOrientation( Orientation.HORIZONTAL );
  timeSlider.valueProperty().addListener( (observable, oldVal, newVal)-> {
    midiHandler.sendLiveControl( 0, 80, newVal.intValue() );
    editPatch.noiseTime = newVal.intValue();
  });
  add( timeSlider, 0, 2 );
  add( new BoundRightControlLabel( "Time", HPos.CENTER, timeSlider ), 0, 1 );
  
  breathSlider = new Slider( 0.0, 127.0, 0.0 );
  breathSlider.setOrientation( Orientation.HORIZONTAL );
  breathSlider.valueProperty().addListener( (observable, oldVal, newVal)-> {
    midiHandler.sendLiveControl( 1, 80, newVal.intValue() );
    editPatch.noiseBreath = newVal.intValue();
  });
  add( breathSlider, 0, 4 );
  add( new BoundRightControlLabel( "Breath", HPos.CENTER, breathSlider ), 0, 3 );
  
  volSlider = new Slider( 0.0, 127.0, 0.0 );
  volSlider.setOrientation( Orientation.VERTICAL );
  GridPane.setRowSpan( volSlider, 3 );
  volSlider.valueProperty().addListener( (observable, oldVal, newVal)-> {
    midiHandler.sendLiveControl( 2, 80, newVal.intValue() );
    editPatch.noiseLevel = newVal.intValue();
  });
  add( volSlider, 1, 1 );
  add( new BoundBelowControlLabel( "Vol", HPos.CENTER, volSlider ), 1, 0 );
}
 
Example #21
Source File: RingProgressIndicatorExample.java    From fx-progress-circle with Apache License 2.0 5 votes vote down vote up
@Override
public void start(Stage primaryStage) {
	RingProgressIndicator indicator = new RingProgressIndicator();
	Slider slider = new Slider(0, 100, 50);

	slider.valueProperty().addListener((o, oldVal, newVal) -> indicator.setProgress(newVal.intValue()));
	VBox main = new VBox(1, indicator, slider);
	indicator.setProgress(Double.valueOf(slider.getValue()).intValue());
	Scene scene = new Scene(main);
	primaryStage.setScene(scene);
	primaryStage.setTitle("Test ring progress");
	primaryStage.show();

}
 
Example #22
Source File: FillProgressIndicatorExample.java    From fx-progress-circle with Apache License 2.0 5 votes vote down vote up
@Override
public void start(Stage primaryStage) {
	FillProgressIndicator indicator = new FillProgressIndicator();
	Slider slider = new Slider(0, 100, 50);
	
	slider.valueProperty().addListener((o, oldVal, newVal) -> indicator.setProgress(newVal.intValue()));
	VBox main = new VBox(1, indicator, slider);
	indicator.setProgress(Double.valueOf(slider.getValue()).intValue());
	Scene scene = new Scene(main);
	primaryStage.setScene(scene);
	primaryStage.setTitle("Test fill progress");
	primaryStage.show();
	
}
 
Example #23
Source File: TestbedSidePanel.java    From jbox2d with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void addSettings(Pane argPanel, TestbedSettings argSettings, SettingType argIgnore) {
  for (TestbedSetting setting : argSettings.getSettings()) {
    if (setting.settingsType == argIgnore) {
      continue;
    }
    switch (setting.constraintType) {
      case RANGE:
        Label text = new Label(setting.name + ": " + setting.value);
        Slider slider = new Slider(setting.min, setting.max, setting.value);
        // slider.setMaximumSize(new Dimension(200, 20));
        slider.valueProperty().addListener((prop, oldValue, newValue) -> {
          stateChanged(slider);
        });
        putClientProperty(slider, "name", setting.name);
        putClientProperty(slider, SETTING_TAG, setting);
        putClientProperty(slider, LABEL_TAG, text);
        argPanel.getChildren().add(text);
        argPanel.getChildren().add(slider);
        break;
      case BOOLEAN:
        CheckBox checkbox = new CheckBox(setting.name);
        checkbox.setSelected(setting.enabled);
        checkbox.selectedProperty().addListener((prop, oldValue, newValue) -> {
          stateChanged(checkbox);
        });
        putClientProperty(checkbox, SETTING_TAG, setting);
        argPanel.getChildren().add(checkbox);
        break;
    }
  }
}
 
Example #24
Source File: PreferencesController.java    From ShootOFF with GNU General Public License v3.0 5 votes vote down vote up
private void linkSliderToLabel(final Slider slider, final Label label) {
	slider.valueProperty().addListener(new ChangeListener<Number>() {
		@Override
		public void changed(ObservableValue<? extends Number> observableValue, Number oldValue, Number newValue) {
			if (newValue == null) {
				label.setText("");
				return;
			}
			label.setText(String.valueOf(newValue.intValue()));
		}
	});
}
 
Example #25
Source File: SettingsPresenter.java    From gluon-samples with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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());
}
 
Example #26
Source File: SettingsPresenter.java    From gluon-samples with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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());
}
 
Example #27
Source File: TimeSlider.java    From regions with Apache License 2.0 5 votes vote down vote up
public TimeSlider() {
    getStyleClass().add("track");
    setFocusTraversable(true);
    setMinWidth(200);
    setMaxWidth(200);

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

    progressBar = new ProgressBar(0);
}
 
Example #28
Source File: SliderSimple.java    From helloiot with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Node constructContent() {
    
    VBox vboxroot = new VBox();
    vboxroot.setSpacing(10.0);
    
    boxview = new HBox();
    boxview.setSpacing(6.0);
    
    level = new Label();
    level.setAlignment(Pos.CENTER_RIGHT);
    level.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    level.getStyleClass().add("unitmaintext");
    HBox.setHgrow(level, Priority.SOMETIMES);
    
    boxview.getChildren().add(level);
    
    slider = new Slider();
    slider.setFocusTraversable(false);
    StackPane.setAlignment(slider, Pos.BOTTOM_CENTER);        
    
    StackPane stack = new StackPane(slider);
    VBox.setVgrow(stack, Priority.SOMETIMES);
    vboxroot.getChildren().addAll(boxview, stack);
    
    initialize();
    
    return vboxroot;
}
 
Example #29
Source File: ParetoTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private void initParts(){
    paretoPanel = new ParetoPanel(createTestData1());

    circleColor = new ColorPicker();
    circleColor.setValue(Color.BLUE);
    graphColor = new ColorPicker();
    graphColor.setValue(Color.BLACK);
    fontColor = new ColorPicker();
    fontColor.setValue(Color.BLACK);

    smoothing = new CheckBox("Smoothing");
    realColor = new CheckBox("AutoSubColor");
    showSubBars = new CheckBox("ShowSubBars");
    singeSubBarCentered = new CheckBox("SingleSubBarCenterd");

    circleSize = new Slider(1,60,20);
    valueHeight = new Slider(0,80,20);
    textHeight = new Slider(0,80,40);
    barSpacing = new Slider(1,50,5);
    pathHeight = new Slider(0,80,65);

    barColors = new ArrayList<>();

    backButton = new Button("Back to last layer");

    exampeColorTheme = createRandomColorTheme(20);

    paretoPanel.addColorTheme("example",exampeColorTheme);
    colorTheme = new ComboBox<>();
    colorTheme.getItems().addAll(paretoPanel.getColorThemeKeys());

    mainBox = new HBox();
    menu = new VBox();
    pane = new Pane();

}
 
Example #30
Source File: View.java    From SynchronizeFX with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * 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);
}