charvax.swing

Class JScrollBar

Implemented Interfaces:
Adjustable

public class JScrollBar
extends JComponent
implements Adjustable

An implementation of a scrollbar. The user positions the knob in the scrollbar to determine the contents of the viewing area.

Field Summary

protected Vector
_adjustmentListeners
A list of AdjustmentListeners registered for this component.

Fields inherited from class charvax.swing.JComponent

_border

Fields inherited from class charva.awt.Component

BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT, _alignmentX, _alignmentY, _background, _cursesColor, _enabled, _focusListeners, _foreground, _keyListeners, _origin, _parent, _visible

Fields inherited from interface charva.awt.Adjustable

HORIZONTAL, VERTICAL

Constructor Summary

JScrollBar()
Creates a vertical scrollbar with default values.
JScrollBar(int orientation_)
Creates a scrollbar with the specified orientation and with default values.
JScrollBar(int orientation_, int value_, int extent_, int min_, int max_)
Creates a scrollbar with the specified orientation, value, extent, min and max.

Method Summary

void
addAdjustmentListener(AdjustmentListener listener_)
Register an AdjustmentListener object for this component.
void
debug(int level_)
void
draw()
Draws the border of the component (if there is one).
int
getBlockIncrement()
Gets the block increment (the amount by which the value will change when the arrow keys are pressed).
int
getHeight()
int
getMaximum()
Gets the maximum value of the adjustable object.
int
getMinimum()
Gets the minimum value of the adjustable object.
int
getOrientation()
Gets the scrollbar's orientation (VERTICAL or HORIZONTAL)
Dimension
getSize()
Get the screen size of the scrollbar.
int
getValue()
Gets the value of the adjustable object.
int
getVisibleAmount()
Gets the length of the proportional indicator.
int
getWidth()
Dimension
minimumSize()
void
processAdjustmentEvent(AdjustmentEvent evt_)
void
processKeyEvent(KeyEvent ke_)
Invoke all the KeyListener callbacks that may have been registered for this component.
void
removeAdjustmentListener(AdjustmentListener listener_)
void
requestFocus()
This method should be invoked by all subclasses of Component which override this method; because this method generates the FOCUS_GAINED event when the component gains the keyboard focus.
void
setBlockIncrement(int val_)
Sets the block increment of the scrollbar.
void
setMaximum(int max_)
Set the scrollbar's maximum value.
void
setMinimum(int min_)
Set the scrollbar's minimum value.
void
setSize(Dimension size_)
Set the size of the component on the screen.
void
setValue(int value_)
Set the scrollbar's value.
void
setVisibleAmount(int extent_)
Set the scrollbar's extent (a.k.a "visible amount").

Methods inherited from class charvax.swing.JComponent

draw, getBorder, getInsets, setBorder

Methods inherited from class charva.awt.Component

addFocusListener, addKeyListener, contains, contains, debug, draw, getAlignmentX, getAlignmentY, getAncestorWindow, getBackground, getBounds, getCursesColor, getForeground, getHeight, getLocation, getLocationOnScreen, getName, getParent, getSize, getWidth, hasFocus, hide, invalidate, isDisplayed, isEnabled, isFocusTraversable, isTotallyObscured, isValid, isVisible, minimumSize, processEvent, processFocusEvent, processKeyEvent, processMouseEvent, repaint, requestFocus, requestSync, setBackground, setBounds, setBounds, setBounds, setEnabled, setForeground, setLocation, setLocation, setName, setParent, setVisible, show, validate, validateCursesColor

Field Details

_adjustmentListeners

protected Vector _adjustmentListeners
A list of AdjustmentListeners registered for this component.

Constructor Details

JScrollBar

public JScrollBar()
Creates a vertical scrollbar with default values.

JScrollBar

public JScrollBar(int orientation_)
Creates a scrollbar with the specified orientation and with default values.

JScrollBar

public JScrollBar(int orientation_,
                  int value_,
                  int extent_,
                  int min_,
                  int max_)
Creates a scrollbar with the specified orientation, value, extent, min and max.

Method Details

addAdjustmentListener

public void addAdjustmentListener(AdjustmentListener listener_)
Register an AdjustmentListener object for this component.
Specified by:
addAdjustmentListener in interface Adjustable

debug

public void debug(int level_)
Overrides:
debug in interface Component

draw

public void draw()
Draws the border of the component (if there is one).
Overrides:
draw in interface JComponent

getBlockIncrement

public int getBlockIncrement()
Gets the block increment (the amount by which the value will change when the arrow keys are pressed).
Specified by:
getBlockIncrement in interface Adjustable

getHeight

public int getHeight()
Overrides:
getHeight in interface Component

getMaximum

public int getMaximum()
Gets the maximum value of the adjustable object.
Specified by:
getMaximum in interface Adjustable

getMinimum

public int getMinimum()
Gets the minimum value of the adjustable object.
Specified by:
getMinimum in interface Adjustable

getOrientation

public int getOrientation()
Gets the scrollbar's orientation (VERTICAL or HORIZONTAL)
Specified by:
getOrientation in interface Adjustable

getSize

public Dimension getSize()
Get the screen size of the scrollbar.
Overrides:
getSize in interface Component

getValue

public int getValue()
Gets the value of the adjustable object.
Specified by:
getValue in interface Adjustable

getVisibleAmount

public int getVisibleAmount()
Gets the length of the proportional indicator.
Specified by:
getVisibleAmount in interface Adjustable

getWidth

public int getWidth()
Overrides:
getWidth in interface Component

minimumSize

public Dimension minimumSize()
Overrides:
minimumSize in interface Component

processAdjustmentEvent

public void processAdjustmentEvent(AdjustmentEvent evt_)
Specified by:
processAdjustmentEvent in interface Adjustable

processKeyEvent

public void processKeyEvent(KeyEvent ke_)
Invoke all the KeyListener callbacks that may have been registered for this component. The KeyListener objects may modify the keycodes, and can also set the "consumed" flag.
Overrides:
processKeyEvent in interface Component

removeAdjustmentListener

public void removeAdjustmentListener(AdjustmentListener listener_)
Specified by:
removeAdjustmentListener in interface Adjustable

requestFocus

public void requestFocus()
This method should be invoked by all subclasses of Component which override this method; because this method generates the FOCUS_GAINED event when the component gains the keyboard focus.
Overrides:
requestFocus in interface Component

setBlockIncrement

public void setBlockIncrement(int val_)
Sets the block increment of the scrollbar.
Specified by:
setBlockIncrement in interface Adjustable

setMaximum

public void setMaximum(int max_)
Set the scrollbar's maximum value.
Specified by:
setMaximum in interface Adjustable

setMinimum

public void setMinimum(int min_)
Set the scrollbar's minimum value.
Specified by:
setMinimum in interface Adjustable

setSize

public void setSize(Dimension size_)
Set the size of the component on the screen. If the scrollbar is vertical, ignore the specified width, and if it is horizontal, ignore the specified height.

setValue

public void setValue(int value_)
Set the scrollbar's value.
Specified by:
setValue in interface Adjustable

setVisibleAmount

public void setVisibleAmount(int extent_)
Set the scrollbar's extent (a.k.a "visible amount").
Specified by:
setVisibleAmount in interface Adjustable