Class marimba.gui.SliderWidget
All Packages Class Hierarchy This Package Previous Next Index
Class marimba.gui.SliderWidget
java.lang.Object
|
+----marimba.gui.Widget
|
+----marimba.gui.ValueWidget
|
+----marimba.gui.SliderWidget
- public class SliderWidget
- extends ValueWidget
An advanced horizontal/vertical slider. The slider supports a number
of options. You can set the slider orientation as vertical or horizontal,
define the width and height of the "slide indicator" and the "slide bar"
components, define the increments of the slider, and whether to display
tick marks for this widget.
The user moves the slide indicator by dragging to a particular location
or clicking in the hot zone area of the bar, which moves the slide
indicator directly to that location. When the slider widget has input
focus, arrow keys can be used to move the slide indicator in te respective
direction represented by the key.
- Version:
- 1.36, 11/28/96
- Author:
- Klaas Waslander
-
direction
- The direction of the slider: by default the value increases
from left to right and from bottom to top.
-
filled
- When a slider is filled, the slider bar and indicator
hide the background.
-
incrementValue
- The number of values to skip before changing value.
-
indHeight
- The height of the slider indicator.
-
indWidth
- The width of the slider indicator.
-
orientation
- A Slider can have a horizontal or vertical orientation.
-
tickMarkInterval
- The number of values between two tickMark
-
tickMarkSize
- The size of the tickMarks.
-
trackAll
- If true, action() is called after every change of the value.
-
useTickMarks
- A slider can display tickMarks to visualize values.
-
SliderWidget()
- Constructor.
-
SliderWidget(int)
- Constructor with orientation
-
action(int)
- The user has changed the value of the Slider.
-
barSize()
- The size of the sliderbar itself,
which is smaller then the size of the widget.
-
focusInterest()
- This widget supports input focus.
-
getDirection()
- Get the direction.
-
getDirectionOptions()
- Get the possible options for the direction.
-
getHeight()
- The height of the Slider.
-
getIncrementValue()
- Get the current increment value.
-
getIndHeight()
- Get the current indicator height.
-
getIndicatorHeight()
- The height of the Slider indicator.
-
getIndicatorWidth()
- The width of the Slider indicator.
-
getIndWidth()
- Get the current indicator width.
-
getMaxWidth()
- The maximum Slider width.
-
getOrientation()
- Get the current orientation.
-
getOrientationOptions()
- Get the possible options for the orientation.
-
getProperties(PropertyList)
- Get the properties.
-
getTickMarkInterval()
- Get the current interval between tick marks.
-
getTickMarkSize()
- Get the current size of the tick marks.
-
getUseTickMarks()
- Get the value of useTickMarks.
-
handleEvent(Event)
- Event handler for possible mouse and keyboard events.
-
isFilled()
- Check if the sliderwidget is filled.
-
isReversed()
- Returns if the slider uses the opposite direction of the
one this slider was initially designed for.
-
nrOfIncrements()
- Calculates the number of increments that can be done given `incrementValue'.
-
paint(Graphics)
- Paint the Slider.
-
paintBrightPattern(Graphics, int, int, int, int)
- Paint a bright pattern on the indicator,
showing that the slider indicator is selected.
-
paintSliderIndicator(Graphics, int, int)
- Paint the Slider indicator at the correct position.
-
paintTickMarks(Graphics)
- Paint the tick marks,
using tickMarkInterval to determine interval between marks.
-
paramString(StringBuffer)
- Debugging.
-
pixelsToValue(int)
- Number of pixels translated into a value.
-
repaintFor(int, int, int)
- Assumes the given values are valid.
-
setDirection(int)
- Set the direction, using the integers UP/DOWN defined in
the class WidgetConstants.
-
setFilled(boolean)
- Let the sliderwidget fill itself or not.
-
setIncrementValue(int)
- Set the increment value to the given value.
-
setIndHeight(int)
- Set the indicator height to the given number of pixels.
-
setIndWidth(int)
- Set the indicator width to the given number of pixels.
-
setOrientation(int)
- Set the orientation, using two integers defined in
the class WidgetConstants.
-
setParam(int, int, int, int, int, int, int, int, boolean, int, int)
- Set all parameters of the Slider at once.
-
setProperties(PropertyList)
- Set the properties.
-
setTickMarkInterval(int)
- Set the interval between tick marks to the given value.
-
setTickMarkSize(int)
- Set the size of the tick marks to the given number of pixels.
-
setTrackAll(boolean)
- Let the Slider call action() after every change of the
value or only once.
-
setUseTickMarks(boolean)
- Set the value of useTickMarks.
-
setValueIncremental(int)
- Set the value to the IncrementValue closest to the given value.
-
tracksAll()
- Check if all changes of the value are being tracked.
-
valueToPixels(int)
- The value translated into pixels.
orientation
public int orientation
- A Slider can have a horizontal or vertical orientation.
- See Also:
- getOrientation, setOrientation, orientationOptions
direction
public int direction
- The direction of the slider: by default the value increases
from left to right and from bottom to top.
- See Also:
- getDirection, setDirection
indWidth
public int indWidth
- The width of the slider indicator.
- See Also:
- getIndWidth, getIndicatorWidth, setIndWidth
indHeight
public int indHeight
- The height of the slider indicator.
- See Also:
- getIndHeight, getIndicatorHeight, setIndHeight
incrementValue
public int incrementValue
- The number of values to skip before changing value.
- See Also:
- getIncrementValue, setIncrementValue
useTickMarks
public boolean useTickMarks
- A slider can display tickMarks to visualize values.
- See Also:
- getUseTickMarks, setUseTickMarks
tickMarkInterval
public int tickMarkInterval
- The number of values between two tickMark
- See Also:
- getTickMarkInterval, setTickMarkInterval
tickMarkSize
public int tickMarkSize
- The size of the tickMarks.
- See Also:
- getTickMarkSize, setTickMarkSize
filled
public boolean filled
- When a slider is filled, the slider bar and indicator
hide the background. A slider is always transparent because
there is a large area that has to display the background.
- See Also:
- isFilled, setFilled
trackAll
public boolean trackAll
- If true, action() is called after every change of the value.
Otherwise action() is only called when the (mouse)button is released.
- See Also:
- tracksAll, setTrackAll
SliderWidget
public SliderWidget()
- Constructor.
SliderWidget
public SliderWidget(int orientation)
- Constructor with orientation
getProperties
public void getProperties(PropertyList list)
- Get the properties.
- Overrides:
- getProperties in class ValueWidget
setProperties
public void setProperties(PropertyList list)
- Set the properties.
- Overrides:
- setProperties in class ValueWidget
setParam
public synchronized void setParam(int value,
int minValue,
int maxValue,
int orientation,
int direction,
int indWidth,
int indHeight,
int incrementValue,
boolean useTickMarks,
int tickMarkInterval,
int tickMarkSize)
- Set all parameters of the Slider at once.
tracksAll
public boolean tracksAll()
- Check if all changes of the value are being tracked.
- See Also:
- trackAll
setTrackAll
public void setTrackAll(boolean trackAll)
- Let the Slider call action() after every change of the
value or only once.
- See Also:
- trackAll
getOrientationOptions
public Options getOrientationOptions()
- Get the possible options for the orientation.
- See Also:
- orientationOptions
getOrientation
public int getOrientation()
- Get the current orientation.
- See Also:
- orientation
setOrientation
public void setOrientation(int orientation)
- Set the orientation, using two integers defined in
the class WidgetConstants.
- See Also:
- orientation
getDirectionOptions
public Options getDirectionOptions()
- Get the possible options for the direction.
- See Also:
- directionOptions
getDirection
public int getDirection()
- Get the direction.
- See Also:
- direction
setDirection
public void setDirection(int direction)
- Set the direction, using the integers UP/DOWN defined in
the class WidgetConstants.
- See Also:
- direction
getIndWidth
public int getIndWidth()
- Get the current indicator width.
- See Also:
- indWidth
setIndWidth
public void setIndWidth(int indWidth)
- Set the indicator width to the given number of pixels.
- See Also:
- indWidth
getIndHeight
public int getIndHeight()
- Get the current indicator height.
- See Also:
- indHeight
setIndHeight
public void setIndHeight(int indHeight)
- Set the indicator height to the given number of pixels.
- See Also:
- indHeight
getIncrementValue
public int getIncrementValue()
- Get the current increment value.
- See Also:
- incrementValue
setIncrementValue
public void setIncrementValue(int incrementValue)
- Set the increment value to the given value.
- See Also:
- incrementValue
getUseTickMarks
public boolean getUseTickMarks()
- Get the value of useTickMarks.
- See Also:
- useTickMarks
setUseTickMarks
public void setUseTickMarks(boolean useTickMarks)
- Set the value of useTickMarks.
- See Also:
- useTickMarks
getTickMarkInterval
public int getTickMarkInterval()
- Get the current interval between tick marks.
- See Also:
- tickMarkInterval
setTickMarkInterval
public void setTickMarkInterval(int tickMarkInterval)
- Set the interval between tick marks to the given value.
- See Also:
- tickMarkInterval
getTickMarkSize
public int getTickMarkSize()
- Get the current size of the tick marks.
- See Also:
- tickMarkSize
setTickMarkSize
public void setTickMarkSize(int tickMarkSize)
- Set the size of the tick marks to the given number of pixels.
- See Also:
- tickMarkSize
isFilled
public boolean isFilled()
- Check if the sliderwidget is filled.
- See Also:
- filled
setFilled
public void setFilled(boolean filled)
- Let the sliderwidget fill itself or not.
- See Also:
- filled
repaintFor
protected boolean repaintFor(int newValue,
int newMin,
int newMax)
- Assumes the given values are valid. Checks whether these values
would result in a new look that requires a repaint.
- Overrides:
- repaintFor in class ValueWidget
paint
public void paint(Graphics g)
- Paint the Slider.
- Overrides:
- paint in class Widget
- See Also:
- paintSliderIndicator, paintBrightPattern, paintTickMarks
paintSliderIndicator
public void paintSliderIndicator(Graphics g,
int x,
int y)
- Paint the Slider indicator at the correct position.
The incrementValue has to be taken into account.
- See Also:
- paint
paintBrightPattern
public void paintBrightPattern(Graphics g,
int x,
int y,
int width,
int height)
- Paint a bright pattern on the indicator,
showing that the slider indicator is selected.
- See Also:
- paint
paintTickMarks
public void paintTickMarks(Graphics g)
- Paint the tick marks,
using tickMarkInterval to determine interval between marks.
- See Also:
- paint
handleEvent
public boolean handleEvent(Event evt)
- Event handler for possible mouse and keyboard events.
When the user tries to change the value, it can only take the values allowed by
`incrementValue'. Through the function `setValue' the value can take other
values, but this is not allowed to happen through the user-interface.
- Overrides:
- handleEvent in class Widget
action
public void action(int id)
- The user has changed the value of the Slider.
focusInterest
public boolean focusInterest()
- This widget supports input focus.
- Overrides:
- focusInterest in class Widget
paramString
public void paramString(StringBuffer buf)
- Debugging.
- Overrides:
- paramString in class ValueWidget
setValueIncremental
public void setValueIncremental(int value)
- Set the value to the IncrementValue closest to the given value.
getIndicatorWidth
public int getIndicatorWidth()
- The width of the Slider indicator.
If the orientation is vertical the width is the indHeight,
otherwise it is just the indWidth.
- See Also:
- indWidth
getIndicatorHeight
public int getIndicatorHeight()
- The height of the Slider indicator.
If the orientation is vertical the height is the indWidth,
otherwise it is just the indHeight.
- See Also:
- indHeight
getMaxWidth
public int getMaxWidth()
- The maximum Slider width. Below the slider is drawn with '=', the area the indicator can
point at is drawn with '~' with the left and right border '[' and ']'. The border of the
widget itself is drawn using '+', '-' and '|'. What this function returns is the width
between '[' and ']', so the maximum area width the indicator can point at.
+--------------------------------------------+
| ======================================== |
| [~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~] |
+--------------------------------------------+
getHeight
public int getHeight()
- The height of the Slider. If the orientation is vertical,
this is the width, otherwise it is just the heigth.
nrOfIncrements
public int nrOfIncrements()
- Calculates the number of increments that can be done given `incrementValue'.
This depends on the range (minValue and maxValue) and the incrementValue.
- See Also:
- incrementValue
isReversed
public boolean isReversed()
- Returns if the slider uses the opposite direction of the
one this slider was initially designed for.
For the horizontal orientation that is the DOWN direction,
for the vertical orientation the UP direction.
- See Also:
- direction
barSize
public int barSize()
- The size of the sliderbar itself,
which is smaller then the size of the widget.
valueToPixels
public int valueToPixels(int value)
- The value translated into pixels.
This function does NOT use `FOCUSSPACE': it pretends that `FOCUSSPACE' is zero.
- See Also:
- pixelsToValue
pixelsToValue
public int pixelsToValue(int pixels)
- Number of pixels translated into a value.
This functions does NOT use `FOCUSSPACE': it pretends that `FOCUSSPACE' is zero.
- See Also:
- valueToPixels
All Packages Class Hierarchy This Package Previous Next Index