public class ScrollBar extends Object implements Renderable
value is
 the current position of the scroll bar. extent represents the visible region. The four values must always
 satisfy this relationship:
 
 min <= value <= value + extent <= max
| Modifier and Type | Class and Description | 
|---|---|
| class  | ScrollBar.ScrollControlControl for the scroll arrows and areas of the scroll bar above and below the knob. | 
| class  | ScrollBar.ScrollKnobControl for dragging the scroll knob. | 
| Modifier and Type | Field and Description | 
|---|---|
| protected Insets | arrowInsetsInsets used to position the triangle in the scroll arrow box. | 
| protected int | autoScrollDelayDelay in milliseconds between each step in auto-scroll operation is effect. | 
| protected String | autoScrollIncrementThe amount and direction that the bar scrolls while auto-scrolling. | 
| protected boolean | autoScrollingIndicates whether an auto-scroll operation is active (such as when the user has clicked and held the mouse on the
 scroll arrow). | 
| static String | BLOCK_DOWNScroll increment for one page down. | 
| static String | BLOCK_UPScroll increment for one page up. | 
| protected Rectangle | boundsFull bounds of the scroll bar. | 
| protected static Insets | DEFAULT_ARROW_INSETSDefault insets that position the triangle of the scroll arrow in its box. | 
| protected static int | DEFAULT_AUTO_SCROLL_DELAYDefault delay, in milliseconds, between auto scroll steps. | 
| protected static Color | DEFAULT_LINE_COLORDefault color used to draw lines in the scroll bar. | 
| protected static int | DEFAULT_MAX_VALUEDefault scroll range maximum value. | 
| protected static int | DEFAULT_MIN_SCROLL_KNOB_SIZEDefault minimum size, in pixels, of the scroll knob. | 
| protected static int | DEFAULT_MIN_VALUEDefault scroll range minimum value. | 
| protected static double | DEFAULT_OPACITYDefault opacity. | 
| protected static Color | DEFAULT_SCROLL_KNOB_COLOR1Default first color in the scroll knob gradient. | 
| protected static Color | DEFAULT_SCROLL_KNOB_COLOR2Default second color in the scroll knob gradient. | 
| protected static int | DEFAULT_UNIT_INCREMENTDefault unit increment. | 
| protected int | extentThe amount of the scroll region that is visible in the frame. | 
| protected long | frameNumberIdentifies frame used to calculate per-frame values. | 
| protected Color | knobColor1First color of the gradient used to fill the scroll knob. | 
| protected Color | knobColor2Second color of the gradient used to fill the scroll knob. | 
| protected Color | lineColorColor applied to lines in the scroll bar. | 
| protected int | maxValueMaximum value in the scroll range. | 
| protected int | minScrollKnobSizeThe minimum size of the scroll knob. | 
| protected int | minValueMinimum value in the scroll range. | 
| protected long | nextAutoScrollTime at which the scrollbar should automatically update itself. | 
| protected double | opacityOpacity of the scroll bar knob. | 
| protected String | orientationScroll bar orientation, either  AVKey.HORIZONTALorAVKey.VERTICAL. | 
| protected PickSupport | pickSupportSupport for setting up and restoring picking state, and resolving the picked object. | 
| protected int | scrollArrowSizeSize, in pixels, of the scroll arrow square. | 
| protected Rectangle | scrollBoundsBounds of the scroll track part of the scroll bar. | 
| protected Rectangle | scrollDownBarBoundsBounds of the scroll bar area below the knob. | 
| protected HotSpot | scrollDownBlockControlHotSpot to handle input on page down control. | 
| protected HotSpot | scrollDownControlHotSpot to handle input on the scroll down control. | 
| protected Rectangle | scrollDownControlBoundsBounds of the "down arrow" control. | 
| protected Rectangle | scrollKnobBoundsBounds of the scroll knob. | 
| protected ScrollBar.ScrollKnob | scrollKnobControlHotSpot to handle input on the scroll knob. | 
| protected Rectangle | scrollUpBarBoundsBounds of the scroll bar area above the knob. | 
| protected HotSpot | scrollUpBlockControlHotSpot to handle input on page up control. | 
| protected HotSpot | scrollUpControlHotSpot to handle input on the scroll up control. | 
| protected Rectangle | scrollUpControlBoundsBounds of the "up arrow" control. | 
| static String | UNIT_DOWNScroll increment for one unit down. | 
| static String | UNIT_UPScroll increment for one unit up. | 
| protected int | unitIncrementAmount that the scroll bar scrolls when the up or down arrow is clicked. | 
| protected int | valueCurrent scroll bar value. | 
| Constructor and Description | 
|---|
| ScrollBar(HotSpot parent)Create a scroll bar in the vertical orientation. | 
| ScrollBar(HotSpot parent,
         String orientation)Create a scroll bar with an orientation. | 
| Modifier and Type | Method and Description | 
|---|---|
| protected boolean | canDrawInBounds()Determines if the scrollbar is able to draw within its bounds. | 
| protected void | computeBounds()Compute the bounds of the scroll bar. | 
| protected void | doPick(DrawContext dc)Pick the scroll bar. | 
| protected void | draw(DrawContext dc)Draw the scroll bar. | 
| protected void | drawPickableQuad(DrawContext dc,
                Object pickObject,
                Rectangle bounds)Draw a filled quad in a unique pick color. | 
| protected void | drawQuad(DrawContext dc,
        Rectangle bounds)Draw the vertices of a quadrilateral. | 
| protected void | drawTriangle(DrawContext dc,
            float rotation,
            Rectangle bounds,
            Insets insets)Draw a triangle for one of the scroll bar controls. | 
| int | getAutoScrollDelay()Indicates how frequently the scrollbar updates while one of the scroll arrows is pressed. | 
| int | getBlockIncrement()Get the block increment. | 
| Rectangle | getBounds()Get the bounds of the scroll bar. | 
| int | getExtent()Get the extent. | 
| Color[] | getKnobColor()Get the color of scroll knob. | 
| protected int | getKnobSize(int scrollAreaSize)Get the size of the scroll knob, in pixels. | 
| Color | getLineColor()Get the color used to draw the lines of the scroll bar boundary and the scroll arrows. | 
| int | getMaxValue()Get the maximum value in the scroll range. | 
| int | getMinScrollKnobSize()Indicates the minimum size of the scrollbar knob, in pixels. | 
| int | getMinValue()Get the minimum value in the scroll range. | 
| double | getOpacity()Indicates the opacity of the scroll knob. | 
| String | getOrientation()Get the scroll bar orientation. | 
| protected int | getScrollArrowSize()Get the height of the scroll arrow controls at the top and bottom of the scroll bar. | 
| int | getUnitIncrement()Get the unit increment. | 
| int | getValue()Get the current value of the scroll bar. | 
| double | getValueAsPercentage()Get the value as a percentage of the scroll range. | 
| protected void | initializeUIControls(HotSpot parent)Initialize the objects that represent the UI controls. | 
| boolean | isAutoScrolling()Is the scroll bar auto-scrolling? | 
| void | render(DrawContext dc)Draw the scroll bar. | 
| void | scroll(int amount)Adjust the scroll value. | 
| void | scroll(String amount)Adjust the scroll bar by the unit amount or the block amount. | 
| void | setAutoScrollDelay(int delay)Specifies how often the scrollbar will update itself when one of the scroll arrows is pressed. | 
| void | setBounds(Rectangle bounds)Set the bounds of the scroll bar. | 
| void | setExtent(int extent)Set the extent. | 
| void | setKnobColor(Color color1,
            Color color2)Set the color of scroll knob. | 
| void | setLineColor(Color color)Set the color of the lines of the scroll bar boundary. | 
| void | setMaxValue(int maxValue)Set the maximum value in the scroll range. | 
| void | setMinScrollKnobSize(int minSize)Specifies the minimum size of the scrollbar knob, in pixels. | 
| void | setMinValue(int minValue)Set the minimum value in the scroll range. | 
| void | setOpacity(double opacity)Specifies the opacity of the scroll knob. | 
| void | setOrientation(String orientation)Set the scroll bar orientation. | 
| void | setUnitIncrement(int unitIncrement)Set the unit increment. | 
| void | setValue(int value)Set the value of the scroll bar. | 
| void | startAutoScroll(String increment)Start an auto-scroll operation. | 
| void | stopAutoScroll()Stop an auto-scroll operation. | 
protected Insets arrowInsets
protected int autoScrollDelay
autoScrollIncrement every autoScrollDelay milliseconds.protected String autoScrollIncrement
UNIT_UP, UNIT_DOWN,
 BLOCK_UP, BLOCK_DOWN.protected boolean autoScrolling
public static final String BLOCK_DOWN
public static final String BLOCK_UP
protected Rectangle bounds
protected static final Insets DEFAULT_ARROW_INSETS
protected static final int DEFAULT_AUTO_SCROLL_DELAY
protected static final Color DEFAULT_LINE_COLOR
protected static final int DEFAULT_MAX_VALUE
protected static final int DEFAULT_MIN_SCROLL_KNOB_SIZE
protected static final int DEFAULT_MIN_VALUE
protected static final double DEFAULT_OPACITY
protected static final Color DEFAULT_SCROLL_KNOB_COLOR1
protected static final Color DEFAULT_SCROLL_KNOB_COLOR2
protected static final int DEFAULT_UNIT_INCREMENT
protected int extent
protected long frameNumber
protected Color knobColor1
protected Color knobColor2
protected Color lineColor
protected int maxValue
protected int minScrollKnobSize
protected int minValue
protected long nextAutoScroll
protected double opacity
protected String orientation
AVKey.HORIZONTAL or AVKey.VERTICAL.protected PickSupport pickSupport
protected int scrollArrowSize
protected Rectangle scrollBounds
protected Rectangle scrollDownBarBounds
protected HotSpot scrollDownBlockControl
protected HotSpot scrollDownControl
protected Rectangle scrollDownControlBounds
protected Rectangle scrollKnobBounds
protected ScrollBar.ScrollKnob scrollKnobControl
protected Rectangle scrollUpBarBounds
protected HotSpot scrollUpBlockControl
protected HotSpot scrollUpControl
protected Rectangle scrollUpControlBounds
public static final String UNIT_DOWN
public static final String UNIT_UP
protected int unitIncrement
protected int value
public ScrollBar(HotSpot parent)
parent - The screen component that contains the scroll bar. Input events that cannot be handled by the
               scroll bar will be passed to this component. May be null.public ScrollBar(HotSpot parent, String orientation)
orientation - Either AVKey.VERTICAL or AVKey.HORIZONTAL.parent - The screen component that contains the scroll bar. Input events that cannot be handled by the
                    scroll bar will be passed to this component. May be null.protected boolean canDrawInBounds()
true if the scroll bar is able to draw within the bounds, or false if the bounds are too
         small to draw without distortion.protected void computeBounds()
protected void doPick(DrawContext dc)
dc - Current draw context.protected void draw(DrawContext dc)
dc - Current draw context.protected void drawPickableQuad(DrawContext dc, Object pickObject, Rectangle bounds)
glBegin(GL.GL_QUADS) and
 glEnd().dc - Current draw context.pickObject - User object to attach to the picked object.bounds - Bounds of the quad.protected void drawQuad(DrawContext dc, Rectangle bounds)
glBegin(GL.GL_QUADS) and glEnd().dc - Current draw context.bounds - Bounds of the quad.protected void drawTriangle(DrawContext dc, float rotation, Rectangle bounds, Insets insets)
dc - Draw context.rotation - Rotation to apply to the triangle. 0 rotation produces a triangle pointing to the right. Rotation
                 must be one of: 0, 90, -90, or 180.bounds - The bounds of the scroll control. The arrow must be drawn within this rectangle.insets - Insets to apply to the bounds.public int getAutoScrollDelay()
public int getBlockIncrement()
public Rectangle getBounds()
public int getExtent()
setExtent(int)public Color[] getKnobColor()
setKnobColor(java.awt.Color, java.awt.Color), 
getLineColor()protected int getKnobSize(int scrollAreaSize)
scrollAreaSize - The size of the scroll area, in pixels.public Color getLineColor()
setLineColor(java.awt.Color), 
getKnobColor()public int getMaxValue()
getMinValue(), 
setMaxValue(int)public int getMinScrollKnobSize()
public int getMinValue()
public double getOpacity()
public String getOrientation()
AVKey.VERTICAL or AVKey.HORIZONTAL.protected int getScrollArrowSize()
public int getUnitIncrement()
setUnitIncrement(int)public int getValue()
public double getValueAsPercentage()
protected void initializeUIControls(HotSpot parent)
parent - The screen component that contains the scroll bar. Input events that cannot be handled by the
               scroll bar will be passed to this component. May be null.public boolean isAutoScrolling()
startAutoScroll(String), 
stopAutoScroll()public void render(DrawContext dc)
render in interface Renderabledc - the DrawContext to be usedDrawContextpublic void scroll(int amount)
amount - Amount to add to the current value. A positive value indicates a scroll down; a negative value
               indicates a scroll up.public void scroll(String amount)
amount - One of UNIT_UP, UNIT_DOWN, BLOCK_UP, or BLOCK_DOWN.public void setAutoScrollDelay(int delay)
delay - Delay in milliseconds between scrollbar updates. A smaller number makes the scrollbar scroll faster,
              a larger number makes it scroll slower. The delay may not be negative.public void setBounds(Rectangle bounds)
bounds - New bounds.public void setExtent(int extent)
min <= value <= value + extent <= max
extent - New extent. If extent is greater than the range of the scroll bar (max - min), then the
               extent will be set to the maximum valid value.getExtent()public void setKnobColor(Color color1, Color color2)
color1 - First color in the gradient.color2 - Second color in the gradient.getKnobColor(), 
setLineColor(java.awt.Color)public void setLineColor(Color color)
color - Color for lines and scroll arrows.getLineColor(), 
setKnobColor(java.awt.Color, java.awt.Color)public void setMaxValue(int maxValue)
maxValue - New maximum.public void setMinScrollKnobSize(int minSize)
minSize - Minimum size of the knob in pixels.public void setMinValue(int minValue)
minValue - New minimum.public void setOpacity(double opacity)
opacity - New opacity.public void setOrientation(String orientation)
orientation - The scroll bar orientation, either AVKey.VERTICAL or AVKey.HORIZONTAL.public void setUnitIncrement(int unitIncrement)
unitIncrement - New unit increment. Must be a positive number.getUnitIncrement()public void setValue(int value)
value - New value.public void startAutoScroll(String increment)
increment - Amount to adjust scroll bar each time. One of UNIT_UP, UNIT_DOWN, BLOCK_UP, or BLOCK_DOWN.stopAutoScroll(), 
isAutoScrolling(), 
scroll(String)public void stopAutoScroll()
startAutoScroll(String), 
isAutoScrolling()