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

Variable Index

 o direction
The direction of the slider: by default the value increases from left to right and from bottom to top.
 o filled
When a slider is filled, the slider bar and indicator hide the background.
 o incrementValue
The number of values to skip before changing value.
 o indHeight
The height of the slider indicator.
 o indWidth
The width of the slider indicator.
 o orientation
A Slider can have a horizontal or vertical orientation.
 o tickMarkInterval
The number of values between two tickMark
 o tickMarkSize
The size of the tickMarks.
 o trackAll
If true, action() is called after every change of the value.
 o useTickMarks
A slider can display tickMarks to visualize values.

Constructor Index

 o SliderWidget()
Constructor.
 o SliderWidget(int)
Constructor with orientation

Method Index

 o action(int)
The user has changed the value of the Slider.
 o barSize()
The size of the sliderbar itself, which is smaller then the size of the widget.
 o focusInterest()
This widget supports input focus.
 o getDirection()
Get the direction.
 o getDirectionOptions()
Get the possible options for the direction.
 o getHeight()
The height of the Slider.
 o getIncrementValue()
Get the current increment value.
 o getIndHeight()
Get the current indicator height.
 o getIndicatorHeight()
The height of the Slider indicator.
 o getIndicatorWidth()
The width of the Slider indicator.
 o getIndWidth()
Get the current indicator width.
 o getMaxWidth()
The maximum Slider width.
 o getOrientation()
Get the current orientation.
 o getOrientationOptions()
Get the possible options for the orientation.
 o getProperties(PropertyList)
Get the properties.
 o getTickMarkInterval()
Get the current interval between tick marks.
 o getTickMarkSize()
Get the current size of the tick marks.
 o getUseTickMarks()
Get the value of useTickMarks.
 o handleEvent(Event)
Event handler for possible mouse and keyboard events.
 o isFilled()
Check if the sliderwidget is filled.
 o isReversed()
Returns if the slider uses the opposite direction of the one this slider was initially designed for.
 o nrOfIncrements()
Calculates the number of increments that can be done given `incrementValue'.
 o paint(Graphics)
Paint the Slider.
 o paintBrightPattern(Graphics, int, int, int, int)
Paint a bright pattern on the indicator, showing that the slider indicator is selected.
 o paintSliderIndicator(Graphics, int, int)
Paint the Slider indicator at the correct position.
 o paintTickMarks(Graphics)
Paint the tick marks, using tickMarkInterval to determine interval between marks.
 o paramString(StringBuffer)
Debugging.
 o pixelsToValue(int)
Number of pixels translated into a value.
 o repaintFor(int, int, int)
Assumes the given values are valid.
 o setDirection(int)
Set the direction, using the integers UP/DOWN defined in the class WidgetConstants.
 o setFilled(boolean)
Let the sliderwidget fill itself or not.
 o setIncrementValue(int)
Set the increment value to the given value.
 o setIndHeight(int)
Set the indicator height to the given number of pixels.
 o setIndWidth(int)
Set the indicator width to the given number of pixels.
 o setOrientation(int)
Set the orientation, using two integers defined in the class WidgetConstants.
 o setParam(int, int, int, int, int, int, int, int, boolean, int, int)
Set all parameters of the Slider at once.
 o setProperties(PropertyList)
Set the properties.
 o setTickMarkInterval(int)
Set the interval between tick marks to the given value.
 o setTickMarkSize(int)
Set the size of the tick marks to the given number of pixels.
 o setTrackAll(boolean)
Let the Slider call action() after every change of the value or only once.
 o setUseTickMarks(boolean)
Set the value of useTickMarks.
 o setValueIncremental(int)
Set the value to the IncrementValue closest to the given value.
 o tracksAll()
Check if all changes of the value are being tracked.
 o valueToPixels(int)
The value translated into pixels.

Variables

 o orientation
  public int orientation
A Slider can have a horizontal or vertical orientation.
See Also:
getOrientation, setOrientation, orientationOptions
 o 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
 o indWidth
  public int indWidth
The width of the slider indicator.
See Also:
getIndWidth, getIndicatorWidth, setIndWidth
 o indHeight
  public int indHeight
The height of the slider indicator.
See Also:
getIndHeight, getIndicatorHeight, setIndHeight
 o incrementValue
  public int incrementValue
The number of values to skip before changing value.
See Also:
getIncrementValue, setIncrementValue
 o useTickMarks
  public boolean useTickMarks
A slider can display tickMarks to visualize values.
See Also:
getUseTickMarks, setUseTickMarks
 o tickMarkInterval
  public int tickMarkInterval
The number of values between two tickMark
See Also:
getTickMarkInterval, setTickMarkInterval
 o tickMarkSize
  public int tickMarkSize
The size of the tickMarks.
See Also:
getTickMarkSize, setTickMarkSize
 o 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
 o 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

Constructors

 o SliderWidget
  public SliderWidget()
Constructor.
 o SliderWidget
  public SliderWidget(int orientation)
Constructor with orientation

Methods

 o getProperties
  public void getProperties(PropertyList list)
Get the properties.
Overrides:
getProperties in class ValueWidget
 o setProperties
  public void setProperties(PropertyList list)
Set the properties.
Overrides:
setProperties in class ValueWidget
 o 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.
 o tracksAll
  public boolean tracksAll()
Check if all changes of the value are being tracked.
See Also:
trackAll
 o setTrackAll
  public void setTrackAll(boolean trackAll)
Let the Slider call action() after every change of the value or only once.
See Also:
trackAll
 o getOrientationOptions
  public Options getOrientationOptions()
Get the possible options for the orientation.
See Also:
orientationOptions
 o getOrientation
  public int getOrientation()
Get the current orientation.
See Also:
orientation
 o setOrientation
  public void setOrientation(int orientation)
Set the orientation, using two integers defined in the class WidgetConstants.
See Also:
orientation
 o getDirectionOptions
  public Options getDirectionOptions()
Get the possible options for the direction.
See Also:
directionOptions
 o getDirection
  public int getDirection()
Get the direction.
See Also:
direction
 o setDirection
  public void setDirection(int direction)
Set the direction, using the integers UP/DOWN defined in the class WidgetConstants.
See Also:
direction
 o getIndWidth
  public int getIndWidth()
Get the current indicator width.
See Also:
indWidth
 o setIndWidth
  public void setIndWidth(int indWidth)
Set the indicator width to the given number of pixels.
See Also:
indWidth
 o getIndHeight
  public int getIndHeight()
Get the current indicator height.
See Also:
indHeight
 o setIndHeight
  public void setIndHeight(int indHeight)
Set the indicator height to the given number of pixels.
See Also:
indHeight
 o getIncrementValue
  public int getIncrementValue()
Get the current increment value.
See Also:
incrementValue
 o setIncrementValue
  public void setIncrementValue(int incrementValue)
Set the increment value to the given value.
See Also:
incrementValue
 o getUseTickMarks
  public boolean getUseTickMarks()
Get the value of useTickMarks.
See Also:
useTickMarks
 o setUseTickMarks
  public void setUseTickMarks(boolean useTickMarks)
Set the value of useTickMarks.
See Also:
useTickMarks
 o getTickMarkInterval
  public int getTickMarkInterval()
Get the current interval between tick marks.
See Also:
tickMarkInterval
 o setTickMarkInterval
  public void setTickMarkInterval(int tickMarkInterval)
Set the interval between tick marks to the given value.
See Also:
tickMarkInterval
 o getTickMarkSize
  public int getTickMarkSize()
Get the current size of the tick marks.
See Also:
tickMarkSize
 o setTickMarkSize
  public void setTickMarkSize(int tickMarkSize)
Set the size of the tick marks to the given number of pixels.
See Also:
tickMarkSize
 o isFilled
  public boolean isFilled()
Check if the sliderwidget is filled.
See Also:
filled
 o setFilled
  public void setFilled(boolean filled)
Let the sliderwidget fill itself or not.
See Also:
filled
 o 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
 o paint
  public void paint(Graphics g)
Paint the Slider.
Overrides:
paint in class Widget
See Also:
paintSliderIndicator, paintBrightPattern, paintTickMarks
 o 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
 o 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
 o paintTickMarks
  public void paintTickMarks(Graphics g)
Paint the tick marks, using tickMarkInterval to determine interval between marks.
See Also:
paint
 o 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
 o action
  public void action(int id)
The user has changed the value of the Slider.
 o focusInterest
  public boolean focusInterest()
This widget supports input focus.
Overrides:
focusInterest in class Widget
 o paramString
  public void paramString(StringBuffer buf)
Debugging.
Overrides:
paramString in class ValueWidget
 o setValueIncremental
  public void setValueIncremental(int value)
Set the value to the IncrementValue closest to the given value.
 o 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
 o 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
 o 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. +--------------------------------------------+ | ======================================== | | [~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~] | +--------------------------------------------+
 o getHeight
  public int getHeight()
The height of the Slider. If the orientation is vertical, this is the width, otherwise it is just the heigth.
 o 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
 o 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
 o barSize
  public int barSize()
The size of the sliderbar itself, which is smaller then the size of the widget.
 o 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
 o 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