Skip to content
anamani edited this page Nov 4, 2014 · 2 revisions

Table of Contents

Slider

Description

The Slider control allows values to be selected by moving a slider around. Slider creation is dynamically possible from Java with the SliderBuilder class as well as from XML using Niftys Standard <control></control> Tag. Minimum and Maximum values as well as the button step size can be specified. It's possible to set an optional step size so that for instance values can only be selected in steps.

Java API

Slider

Standard Parameters

The following table describes all CheckBox parameters.

Name Datatype Default Description
min Float 0.0 The minimum value of the Slider.
max Float 100.0 The maximum value of the Slider.
initial Float 0.0 The initial value of the Slider.
stepSize Float 1.0 The step size of changes. If you would set this to 10.0 for instance the slider will only allow the value to be changed in steps of 10.
buttonStepSize Float 25.0 This specifies how much the value changes when the up/down or left/right buttons are clicked.

EventBus Notification

The Slider supports EventBus notification for any action that changes the value of the Slider (Mouse click or Keyboard Activation). In that case a SliderChangedEvent is published using the id of the Slider as the Topic for the Event.

SliderChangedEvent

Java Builder Example

// Using the builder pattern
control(new SliderBuilder("sliderR", true)); // creates a vertical slider
control(new SliderBuilder("sliderA", false)); // creates a horizontal slider

XML Example

<!-- simple sliders. please note: event notification requires an id -->
<control id="sliderV" name="verticalSlider" height="100px" />
<control id="sliderH" name="horizontalSlider" width="100px" />

Back to Nifty Standard Controls (Nifty 1.3)

Clone this wiki locally