buoy.widget

Class BScrollBar


public class BScrollBar
extends Widget

A BScrollBar is a Widget that allows the user to select a single value by dragging a "thumb" along a bar. The size of the thumb can be variable, so as to represent a selected region of the range. The size and position of the thumb are determined by four properties:

minimum: the lower end of the range represented by the scrollbar
value: the lower end of the "selected region" represented by the thumb
extent: the size of the "selected region" represented by the thumb
maximum: the upper end of the range represented by the scrollbar

Thus, the "value" of the scrollbar can vary between minimum and maximum-extent, inclusive.

In addition to the event types generated by all Widgets, BScrollBars generate the following event types:

Author:
Peter Eastman

Nested Class Summary

static class
BScrollBar.Orientation
This inner class represents an orientation for the scrollbar.

Field Summary

static BScrollBar.Orientation
HORIZONTAL
static BScrollBar.Orientation
VERTICAL

Constructor Summary

BScrollBar()
Create a new BScrollBar.
BScrollBar(int value, int extent, int minimum, int maximum, BScrollBar.Orientation orientation)
Create a new BScrollBar.

Method Summary

int
getBlockIncrement()
Get the amount by which this BScrollBar will scroll when the user clicks in the body of the scrollbar.
int
getExtent()
Get the extent of this BScrollBar's thumb.
int
getMaximum()
Get the maximum value of the range represented by this BScrollBar.
int
getMinimum()
Get the minimum value of the range represented by this BScrollBar.
BScrollBar.Orientation
getOrientation()
Get the orientation (HORIZONTAL or VERTICAL) of this BScrollBar.
int
getUnitIncrement()
Get the amount by which this BScrollBar will scroll when the user clicks on one of the arrows at its end.
int
getValue()
Get the current value of this BScrollBar.
void
setBlockIncrement(int increment)
Set the amount by which this BScrollBar will scroll when the user clicks in the body of the scrollbar.
void
setExtent(int value)
Set the extent of this BScrollBar's thumb.
void
setMaximum(int value)
Set the maximum value of the range represented by this BScrollBar.
void
setMinimum(int value)
Set the minimum value of the range represented by this BScrollBar.
void
setOrientation(BScrollBar.Orientation orientation)
Set the orientation (HORIZONTAL or VERTICAL) of this BScrollBar.
void
setUnitIncrement(int increment)
Set the amount by which this BScrollBar will scroll when the user clicks on one of the arrows at its end.
void
setValue(int value)
Set the current value of this BScrollBar.

Methods inherited from class buoy.widget.Widget

addEventLink, dispatchEvent, getBackground, getBounds, getComponent, getCursor, getFont, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, hasFocus, isEnabled, isFocusable, isVisible, repaint, requestFocus, setBackground, setCursor, setEnabled, setFocusable, setFont, setName, setVisible

Methods inherited from class buoy.event.EventSource

addEventLink, addEventLink, addEventLink, dispatchEvent, removeEventLink

Field Details

HORIZONTAL

public static final BScrollBar.Orientation HORIZONTAL

VERTICAL

public static final BScrollBar.Orientation VERTICAL

Constructor Details

BScrollBar

public BScrollBar()
Create a new BScrollBar.

BScrollBar

public BScrollBar(int value,
                  int extent,
                  int minimum,
                  int maximum,
                  BScrollBar.Orientation orientation)
Create a new BScrollBar.
Parameters:
value - the BScrollBar's initial value
extent - the size of the region represented by the thumb
minimum - the minimum value for the range represented by the BScrollBar
maximum - the maximum value for the range represented by the BScrollBar
orientation - defines how the BScrollBar should be drawn and positioned. This should be HORIZONTAL or VERTICAL.

Method Details

getBlockIncrement

public int getBlockIncrement()
Get the amount by which this BScrollBar will scroll when the user clicks in the body of the scrollbar.

getExtent

public int getExtent()
Get the extent of this BScrollBar's thumb.

getMaximum

public int getMaximum()
Get the maximum value of the range represented by this BScrollBar.

getMinimum

public int getMinimum()
Get the minimum value of the range represented by this BScrollBar.

getOrientation

public BScrollBar.Orientation getOrientation()
Get the orientation (HORIZONTAL or VERTICAL) of this BScrollBar.

getUnitIncrement

public int getUnitIncrement()
Get the amount by which this BScrollBar will scroll when the user clicks on one of the arrows at its end.

getValue

public int getValue()
Get the current value of this BScrollBar.

setBlockIncrement

public void setBlockIncrement(int increment)
Set the amount by which this BScrollBar will scroll when the user clicks in the body of the scrollbar.

setExtent

public void setExtent(int value)
Set the extent of this BScrollBar's thumb.

setMaximum

public void setMaximum(int value)
Set the maximum value of the range represented by this BScrollBar.

setMinimum

public void setMinimum(int value)
Set the minimum value of the range represented by this BScrollBar.

setOrientation

public void setOrientation(BScrollBar.Orientation orientation)
Set the orientation (HORIZONTAL or VERTICAL) of this BScrollBar.

setUnitIncrement

public void setUnitIncrement(int increment)
Set the amount by which this BScrollBar will scroll when the user clicks on one of the arrows at its end.

setValue

public void setValue(int value)
Set the current value of this BScrollBar.

Written by Peter Eastman.