Class Slider
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----Slider
- public class Slider
- extends Panel
This class produces a slider control that can be configured as
an integer or floating-point input device.
- See Also:
- SliderListener
-
bar
- scrollbar that does most of the work
-
listener
- a listener to this slider
-
slider_id
- assigned slider id
-
value_label
- scaling factor: 1 (10^0) for integer type; 10^n - for floats with n decimal places
int scaler;
/** label indicating the current value
-
Slider(SliderListener, int, int, float, float, float, String)
- Constructs a floating-point slider.
-
Slider(SliderListener, int, int, int, int, int, String)
- Constructs an integer slider.
-
handleEvent(Event)
- Handles scrollbar events.
-
insets()
- Overrides the default insets() method.
-
minimumSize()
- Overrides the default minimumSize() method.
-
preferredSize()
- Overrides the default preferredSize() method.
-
setBackground(Color)
- Sets the color of the bar.
-
setValue(float)
- Sets new value.
-
setValue(int)
- Sets new value.
-
valueToString(float)
- Converts value to string.
listener
SliderListener listener
- a listener to this slider
slider_id
int slider_id
- assigned slider id
bar
Scrollbar bar
- scrollbar that does most of the work
value_label
Label value_label
- scaling factor: 1 (10^0) for integer type; 10^n - for floats with n decimal places
int scaler;
/** label indicating the current value
Slider
public Slider(SliderListener listener,
int slider_id,
int orientation,
int initial,
int min_value,
int max_value,
String caption)
- Constructs an integer slider.
- Parameters:
- listener - slider event listener.
- slider_id - slider id
- orientation - java.awt.Scrollbar.VERTICAL or HORIZONTAL
- initial - initial value
- min_value - minimum value
- max_value - maximum value
- caption - caption string
Slider
public Slider(SliderListener listener,
int slider_id,
int orientation,
float initial,
float min_value,
float max_value,
String caption)
- Constructs a floating-point slider.
- Parameters:
- listener - slider event listener.
- slider_id - slider id
- orientation - java.awt.Scrollbar.VERTICAL or HORIZONTAL
- initial - initial value
- min_value - minimum value
- max_value - maximum value
- caption - caption string
setBackground
public void setBackground(Color color)
- Sets the color of the bar.
- Parameters:
- color - scrollbar background color
- Overrides:
- setBackground in class Component
setValue
public void setValue(int value)
- Sets new value.
- Parameters:
- value - new value
setValue
public void setValue(float value)
- Sets new value.
- Parameters:
- value - new value
handleEvent
public boolean handleEvent(Event evt)
- Handles scrollbar events.
- Overrides:
- handleEvent in class Component
valueToString
String valueToString(float z)
- Converts value to string. Two decimal places are retained.
- Parameters:
- z - value to be converted
minimumSize
public Dimension minimumSize()
- Overrides the default minimumSize() method.
- Returns:
- new Dimension
- Overrides:
- minimumSize in class Container
preferredSize
public Dimension preferredSize()
- Overrides the default preferredSize() method.
- Returns:
- new Dimension
- Overrides:
- preferredSize in class Container
insets
public Insets insets()
- Overrides the default insets() method.
- Returns:
- new Insets
- Overrides:
- insets in class Container