diff options
Diffstat (limited to 'documentation/components/components-slider.asciidoc')
-rw-r--r-- | documentation/components/components-slider.asciidoc | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/documentation/components/components-slider.asciidoc b/documentation/components/components-slider.asciidoc index bc36fea39d..eb88433729 100644 --- a/documentation/components/components-slider.asciidoc +++ b/documentation/components/components-slider.asciidoc @@ -16,15 +16,18 @@ The [classname]#Slider# is a vertical or horizontal bar that allows setting a numeric value within a defined range by dragging a bar handle with the mouse. The value is shown when dragging the handle. -[classname]#Slider# has a number of different constructors that take a -combination of the caption, __minimum__ and __maximum__ value, __resolution__, -and the __orientation__ of the slider. +[[figure.components.slider.example1]] +.Vertical and horizontal [classname]#Slider# components +image::img/slider-example1-hi.png[width=40%, scaledwidth=70%] +[classname]#Slider# has a number of different constructors that take a +combination of the caption, _minimum_ and _maximum_ value, _resolution_, +and the _orientation_ of the slider. [source, java] ---- // Create a vertical slider -final Slider vertslider = new Slider(1, 100); +Slider vertslider = new Slider(1, 100); vertslider.setOrientation(SliderOrientation.VERTICAL); ---- @@ -34,17 +37,12 @@ __max__:: Maximum value of the slider range. The default is 100.0. __resolution__:: The number of digits after the decimal point. The default is 0. -__orientation__:: The orientation can be either horizontal ( -[parameter]#SliderOrientation.HORIZONTAL#) or vertical ( -[parameter]#SliderOrientation.VERTICAL#). The default is horizontal. - - +__orientation__:: The orientation can be either horizontal ([parameter]#SliderOrientation.HORIZONTAL#) or vertical ([parameter]#SliderOrientation.VERTICAL#). The default is horizontal. As the [classname]#Slider# is a field component, you can handle value changes with a [classname]#ValueChangeListener#. The value of the [classname]#Slider# field is a [classname]#Double# object. - [source, java] ---- // Shows the value of the vertical slider @@ -72,14 +70,13 @@ You can set the value with the [methodname]#setValue()# method defined in [classname]#Slider# that takes the value as a native double value. The setter can throw a [classname]#ValueOutOfBoundsException#, which you must handle. - [source, java] ---- // Set the initial value. This has to be set after the // listener is added if we want the listener to handle // also this value change. try { - vertslider.setValue(50.0); + vertslider.setValue(50.0); } catch (ValueOutOfBoundsException e) { } ---- @@ -91,10 +88,6 @@ does not do bounds checking. examples) and horizontal sliders that control the size of a box. The slider values are displayed also in separate labels. -[[figure.components.slider.example1]] -.The [classname]#Slider# Component -image::img/slider-example1-hi.png[] - == CSS Style Rules @@ -111,7 +104,3 @@ higher (for horizontal slider) or wider (for vertical slider) than the bar, the handle element is nevertheless contained within the slider bar element. The appearance of the handle comes from a background image defined in the __background__ CSS property. - - - - |