Class marimba.gui.ScrollbarWidget
All Packages Class Hierarchy This Package Previous Next Index
Class marimba.gui.ScrollbarWidget
java.lang.Object
|
+----marimba.gui.Widget
|
+----marimba.gui.ValueWidget
|
+----marimba.gui.ScrollbarWidget
- public class ScrollbarWidget
- extends ValueWidget
- implements TimerClient
A horizontal/vertical scrollbar. It can be horizontal or vertical,
supports a proportional scroll box which means that the box
represents the current page size and offers many other useful
properties.
The scrollbar repaints have been optimized in the sense that it
only repaints when absolutely necessary.
- Version:
- 1.55, 01/08/97
- Author:
- Klaas Waslander
-
autoSetValue
- A scrollbar can automatically set the value based
on the action.
-
constrained
- Constrain to maxValue - pageSize.
-
lineSize
- This controls how much you scroll when pressing
a scroll arrow.
-
orientation
- A scrollbar can be horizontal and vertical.
-
orientationOptions
- The possible options for the orientation.
-
pageSize
- Determines the visible portion of the scrollbar.
-
proportional
- A scrollbar can be proportional, which means that the
size of the scroll box represents the pagesize.
-
scrollMore
- The maximum value of the scrollbar when pressing the down/right
arrow can be made larger using this variable.
-
speed
- The repeat rate in times/second for the scroll arrows.
-
trackAll
- If true, action() is called after every change of the value.
-
ScrollbarWidget()
- Constructor.
-
ScrollbarWidget(int)
- Constructor with orientation.
-
action(int)
- The user has changed the value of the scrollbar.
-
action(int, boolean)
- Posts the event and calls action() if the boolean is true.
-
findTarget(int, int)
- Find the scrollbar target under the given coordinates.
-
getAutoSetValue()
- Check if this scrollbar has to set the value based on the
action automatically.
-
getBoxSize()
- Get the size of the scroll box in pixels,
based on the pageSize or just square if the scrollbar
is not proportional.
-
getLineSize()
- Check the line size: how much the scroll box skips
when pressing one of the scroll arrows.
-
getMaxScrollValue()
- Get the maximum scroll value, which is the maximum value when
dragging the scroll box.
-
getOrientation()
- Get the orientation of the scrollbar.
-
getOrientationOptions()
- Get the possible options for the orientation.
-
getPageSize()
- Get the current size of the page, which controls
the size of the scroll box.
-
getProperties(PropertyList)
- Get the properties.
-
getScrollMore()
- Get the adjustment of the maxValue for the unconstrained
mode of this scrollbar.
-
getShaftSize()
- Get the size of the scroll bar shaft in pixels.
-
getSpeed()
- Check the repeat rate in times/second for the scroll arrows.
-
handleEvent(Event)
- Event handler for mouse events.
-
isConstrained()
- Check if this scrollbar is constrained.
-
isFilled()
- Check if the scrollbar is filled.
-
isProportional()
- Check whether this scroll bar is proportional.
-
paint(Graphics)
- Paint the scrollbar.
-
paintScrollBox(Graphics, int, int, int, int)
- Paint the scroll box at the given position and fill the scroll shaft
above and below the box with the hilite color if the scroll bar is filled.
-
paramString(StringBuffer)
- Debugging.
-
pixelsToValue(int)
- Returns the scrollbar value given the specified pixelValue.
-
repaintFor(int, int, int)
- Assumes the given values are valid.
-
setAutoSetValue(boolean)
- Turn on or off automatically setting the value based on the
action.
-
setConstrained(boolean)
- Turn on or off automatically constraining
the value based on the page size.
-
setFilled(boolean)
- Let the scrollbar fill itself.
-
setInputValue(int)
- Sets the value of the scrollbar only if autoSetValue is true.
-
setLineSize(int)
- Set the line size.
-
setOrientation(int)
- Set the orientation to horizontal or vertical.
-
setPageSize(int)
- Set the current size of the page.
-
setParam(int, int, int)
- Set the value, minValue and maxValue all at once.
-
setParam(int, int, int, int, int)
- Set all parameters of the scroll bar at once.
-
setProperties(PropertyList)
- Set the properties.
-
setProportional(boolean)
- Let the scroll box always be square or let it
represent the current page size.
-
setScrollMore(int)
- Set the adjusting value of the scrollbar for unconstrained mode.
-
setSpeed(int)
- Set the repeat rate in times/second for the scroll arrows.
-
setTrackAll(boolean)
- Let the scrollbar call action() after every change of the
value or only once.
-
startPageScrolling(int, int)
- Start auto-scrolling pages.
-
tick(long, Object)
- Auto repeat
-
tracksAll()
- Check if all changes of the value are being tracked.
-
validate()
- Validates the scroll bar.
-
valueToPixels(int)
- Translates the given value to the number of pixels
between the scroll box and the left/bottom.
orientationOptions
public static Options orientationOptions
- The possible options for the orientation.
- See Also:
- getOrientationOptions, orientation
orientation
public int orientation
- A scrollbar can be horizontal and vertical.
- See Also:
- getOrientation, setOrientation, orientationOptions
proportional
public boolean proportional
- A scrollbar can be proportional, which means that the
size of the scroll box represents the pagesize.
If it is not proportional, the scroll box is always
square.
- See Also:
- isProportional, setProportional
lineSize
public int lineSize
- This controls how much you scroll when pressing
a scroll arrow.
- See Also:
- setLineSize, getLineSize
pageSize
public int pageSize
- Determines the visible portion of the scrollbar.
This controls the size of the scroll box.
- See Also:
- getPageSize, setPageSize
speed
public int speed
- The repeat rate in times/second for the scroll arrows.
This controls how fast the scroll box moves.
- See Also:
- getSpeed, setSpeed
autoSetValue
public boolean autoSetValue
- A scrollbar can automatically set the value based
on the action.
- See Also:
- getAutoSetValue, setAutoSetValue
constrained
public boolean constrained
- Constrain to maxValue - pageSize. This means that it is not
possible to scroll further using the down arrow when the end
has been reached.
- See Also:
- isConstrained, setConstrained
scrollMore
public int scrollMore
- The maximum value of the scrollbar when pressing the down/right
arrow can be made larger using this variable.
It must be used when you want to enable the scrollbar to scroll
further (or less) then one page when the scrollbar is unconstrained.
- See Also:
- getScrollMore, setScrollMore
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
ScrollbarWidget
public ScrollbarWidget()
- Constructor.
ScrollbarWidget
public ScrollbarWidget(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
isFilled
public boolean isFilled()
- Check if the scrollbar is filled. If the scrollbar is filled
it is not transparent.
- See Also:
- transparent, setFilled
setFilled
public void setFilled(boolean filled)
- Let the scrollbar fill itself. If the scrollbar is filled
it is not transparent.
- See Also:
- transparent, isFilled
getOrientationOptions
public Options getOrientationOptions()
- Get the possible options for the orientation.
- See Also:
- orientationOptions
getOrientation
public int getOrientation()
- Get the orientation of the scrollbar.
- See Also:
- orientation
setOrientation
public void setOrientation(int orientation)
- Set the orientation to horizontal or vertical.
- See Also:
- orientation
isProportional
public boolean isProportional()
- Check whether this scroll bar is proportional.
- See Also:
- proportional
setProportional
public void setProportional(boolean proportional)
- Let the scroll box always be square or let it
represent the current page size.
- See Also:
- proportional
validate
public void validate()
- Validates the scroll bar.
Calculates sizes of some drawing parameters.
- Overrides:
- validate in class Widget
getAutoSetValue
public boolean getAutoSetValue()
- Check if this scrollbar has to set the value based on the
action automatically.
- See Also:
- autoSetValue
setAutoSetValue
public void setAutoSetValue(boolean autoSetValue)
- Turn on or off automatically setting the value based on the
action.
- See Also:
- autoSetValue
isConstrained
public boolean isConstrained()
- Check if this scrollbar is constrained.
- See Also:
- constrained
setConstrained
public void setConstrained(boolean constrained)
- Turn on or off automatically constraining
the value based on the page size.
- See Also:
- constrained
getScrollMore
public int getScrollMore()
- Get the adjustment of the maxValue for the unconstrained
mode of this scrollbar.
- See Also:
- scrollMore
setScrollMore
public void setScrollMore(int scrollMore)
- Set the adjusting value of the scrollbar for unconstrained mode.
Set it to zero for the default behaviour of being able to scroll
one page further when unconstrained.
- See Also:
- scrollMore
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 scrollbar call action() after every change of the
value or only once.
- See Also:
- trackAll
getLineSize
public int getLineSize()
- Check the line size: how much the scroll box skips
when pressing one of the scroll arrows.
- See Also:
- lineSize
setLineSize
public synchronized void setLineSize(int lineSize)
- Set the line size. This controls how much the scroll box skips
when pressing one of the scroll arrows.
- See Also:
- lineSize
getPageSize
public int getPageSize()
- Get the current size of the page, which controls
the size of the scroll box.
- See Also:
- pageSize
setPageSize
public synchronized void setPageSize(int pageSize)
- Set the current size of the page.
This controls the size of the scrolling bar.
- See Also:
- pageSize
setParam
public synchronized void setParam(int value,
int minValue,
int maxValue,
int lineSize,
int pageSize)
- Set all parameters of the scroll bar at once.
getSpeed
public int getSpeed()
- Check the repeat rate in times/second for the scroll arrows.
- See Also:
- speed
setSpeed
public void setSpeed(int speed)
- Set the repeat rate in times/second for the scroll arrows.
- See Also:
- speed
getShaftSize
public int getShaftSize()
- Get the size of the scroll bar shaft in pixels.
getBoxSize
public int getBoxSize()
- Get the size of the scroll box in pixels,
based on the pageSize or just square if the scrollbar
is not proportional.
getMaxScrollValue
public int getMaxScrollValue()
- Get the maximum scroll value, which is the maximum value when
dragging the scroll box. This always equals maxValue - pageSize.
setParam
public synchronized void setParam(int value,
int minValue,
int maxValue)
- Set the value, minValue and maxValue all at once.
The value can get larger than the maxValue if the scrollbar
is unconstrained: the value will go up to 'scrollMax'.
- Overrides:
- setParam in class ValueWidget
valueToPixels
public int valueToPixels(int value)
- Translates the given value to the number of pixels
between the scroll box and the left/bottom.
pixelsToValue
public int pixelsToValue(int pixels)
- Returns the scrollbar value given the specified pixelValue.
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 scrollbar.
- Overrides:
- paint in class Widget
- See Also:
- paintScrollBox
paintScrollBox
protected void paintScrollBox(Graphics g,
int x,
int y,
int boxWidth,
int boxHeight)
- Paint the scroll box at the given position and fill the scroll shaft
above and below the box with the hilite color if the scroll bar is filled.
If the scrollbar is currently paging down or up, the scroll shaft is filled
with an appropriate color.
- See Also:
- paint
tick
public long tick(long tm,
Object arg)
- Auto repeat
- Overrides:
- tick in class Widget
setInputValue
protected synchronized void setInputValue(int value)
- Sets the value of the scrollbar only if autoSetValue is true.
The inputValue is remembered, even if autoSetValue is false.
When the scrollbar is unconstrained this method will set the
input value up to scrollMax.
startPageScrolling
protected void startPageScrolling(int type,
int mousePos)
- Start auto-scrolling pages.
findTarget
protected int findTarget(int x,
int y)
- Find the scrollbar target under the given coordinates.
This can be UP, DOWN, PAGE_UP, PAGE_DOWN or -1 if no target is found.
handleEvent
public boolean handleEvent(Event evt)
- Event handler for mouse events.
- Overrides:
- handleEvent in class Widget
action
public void action(int id)
- The user has changed the value of the scrollbar.
action
protected void action(int id,
boolean action)
- Posts the event and calls action() if the boolean is true.
paramString
public void paramString(StringBuffer buf)
- Debugging.
- Overrides:
- paramString in class ValueWidget
All Packages Class Hierarchy This Package Previous Next Index