Package org.eclipse.draw2d
Class ScrollBar
java.lang.Object
org.eclipse.draw2d.Figure
org.eclipse.draw2d.ScrollBar
- All Implemented Interfaces:
- PropertyChangeListener,- EventListener,- IFigure,- Orientable,- PositionConstants
- Direct Known Subclasses:
- PuristicScrollPane.PuristicScrollBar
Provides for the scrollbars used by the 
ScrollPane. A ScrollBar is
 made up of five essential Figures: An 'Up' arrow button, a 'Down' arrow
 button, a draggable 'Thumb', a 'Pageup' button, and a 'Pagedown' button.- 
Nested Class SummaryNested ClassesNested classes/interfaces inherited from class org.eclipse.draw2d.FigureFigure.FigureIterator, Figure.IdentitySearch, Figure.ReverseFigureChildrenIteratorNested classes/interfaces inherited from interface org.eclipse.draw2d.IFigureIFigure.NoInsets
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected static final intprotected ScrollBar.ThumbDraggerListens to mouse events on the scrollbar to take care of scrolling.protected final TransposerTransposes from vertical to horizontal if needed.Fields inherited from class org.eclipse.draw2d.FigurebgColor, border, bounds, fgColor, flags, font, maxSize, minSize, NO_MANAGER, prefSize, toolTipFields inherited from interface org.eclipse.draw2d.IFigureMAX_DIMENSION, MIN_DIMENSION, NO_INSETSFields inherited from interface org.eclipse.draw2d.OrientableHORIZONTAL, VERTICALFields inherited from interface org.eclipse.draw2d.PositionConstantsALWAYS_LEFT, ALWAYS_RIGHT, BOTTOM, CENTER, EAST, EAST_WEST, LEFT, LEFT_CENTER_RIGHT, MIDDLE, NONE, NORTH, NORTH_EAST, NORTH_SOUTH, NORTH_WEST, NSEW, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TOP_MIDDLE_BOTTOM, WEST
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected ClickableCreates the default 'Down' ArrowButton for the ScrollBar.protected IFigureCreates the Scrollbar's "thumb", the draggable Figure that indicates the Scrollbar's position.protected ClickableCreates the default 'Up' ArrowButton for the ScrollBar.protected ClickableCreates the pagedown Figure for the Scrollbar.protected ClickableCreates the pageup Figure for the Scrollbar.protected IFigureReturns the figure used as the down button.protected IFigureReturns the figure used as the up button.intReturns the extent.intReturns the maximum value.intReturns the minumum value.protected IFigureReturns the figure used for page down.intReturns the the amound the scrollbar will move when the page up or page down areas are pressed.protected IFigureReturns the figure used for page up.Returns the range model for this scrollbar.intReturns the amount the scrollbar will move when the up or down arrow buttons are pressed.protected IFiguregetThumb()Returns the figure used as the scrollbar's thumb.intgetValue()Returns the current scroll position of the scrollbar.protected intReturns the size of the range of allowable values.protected voidInitilization of the ScrollBar.booleanReturnstrueif this scrollbar is orientated horizontally,falseotherwise.voidvoidInvalidates this figure and revalidates() its parent.voidsetDirection(int direction) Does nothing because this doesn't make sense for a scrollbar.voidsetDownClickable(Clickable down) Sets the Clickable that represents the down arrow of the Scrollbar to down.voidsetEnabled(boolean value) Sets this IFigure to be enabled.voidsetExtent(int ext) Sets the extent of the Scrollbar to extfinal voidsetHorizontal(boolean value) Sets the orientation of the ScrollBar.voidsetMaximum(int max) Sets the maximum position to max.voidsetMinimum(int min) Sets the minimum position to min.voidsetOrientation(int value) Sets the orientation.voidsetPageDown(Clickable down) Sets the pagedown button to the passed Clickable.voidsetPageIncrement(int increment) Sets the ScrollBar to scroll increment pixels when its pageup or pagedown buttons are pressed.voidSets the pageup button to the passed Clickable.voidsetRangeModel(RangeModel rangeModel) Sets the ScrollBar's RangeModel to the passed value.voidsetStepIncrement(int increment) Sets the ScrollBar's step increment to the passed value.voidSets the ScrollBar's thumb to the passed Figure.voidSets the Clickable that represents the up arrow of the Scrollbar to up.voidsetValue(int v) Sets the value of the Scrollbar to vprotected voidstepDown()Causes the ScrollBar to scroll down (or right) by the value of its step increment.protected voidstepUp()Causes the ScrollBar to scroll up (or left) by the value of its step increment.Methods inherited from class org.eclipse.draw2d.Figureadd, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireCoordinateSystemChanged, fireFigureMoved, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getBounds, getChildren, getChildrenRevIterable, getClientArea, getClientArea, getClippingStrategy, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, getListenersIterable, getLocalBackgroundColor, getLocalFont, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, handleMouseWheelScrolled, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isMouseEventTarget, isOpaque, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, layout, optimizeClip, paint, paintBorder, paintChildren, paintClientArea, paintFigure, primTranslate, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, setBackgroundColor, setBorder, setBounds, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setClippingStrategy, setConstraint, setCursor, setFlag, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setValid, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, useLocalCoordinates, validateMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.draw2d.IFigureadd, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getClientArea, getClippingStrategy, getCursor, getFont, getForegroundColor, getInsets, getLayoutManager, getLocalBackgroundColor, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, handleMouseWheelScrolled, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isOpaque, isRequestFocusEnabled, isShowing, isVisible, paint, remove, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, setBackgroundColor, setBorder, setBounds, setClippingStrategy, setConstraint, setCursor, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, validate
- 
Field Details- 
MAX_FLAGprotected static final int MAX_FLAG- See Also:
 
- 
thumbDraggerListens to mouse events on the scrollbar to take care of scrolling.
- 
transposerTransposes from vertical to horizontal if needed.
 
- 
- 
Constructor Details- 
ScrollBarpublic ScrollBar()Constructs a ScrollBar. ScrollBar orientation is vertical by default. CallsetHorizontal(boolean)withtrueto set horizontal orientation.- Since:
- 2.0
 
 
- 
- 
Method Details- 
createDefaultUpButtonCreates the default 'Up' ArrowButton for the ScrollBar.- Returns:
- the up button
- Since:
- 2.0
 
- 
createDefaultDownButtonCreates the default 'Down' ArrowButton for the ScrollBar.- Returns:
- the down button
- Since:
- 2.0
 
- 
createPageDownCreates the pagedown Figure for the Scrollbar.- Returns:
- the page down figure
- Since:
- 2.0
 
- 
createPageUpCreates the pageup Figure for the Scrollbar.- Returns:
- the page up figure
- Since:
- 2.0
 
- 
createDefaultThumbCreates the Scrollbar's "thumb", the draggable Figure that indicates the Scrollbar's position.- Returns:
- the thumb figure
- Since:
- 2.0
 
- 
getButtonUpReturns the figure used as the up button.- Returns:
- the up button
 
- 
getButtonDownReturns the figure used as the down button.- Returns:
- the down button
 
- 
getExtentpublic int getExtent()Returns the extent.- Returns:
- the extent
- See Also:
 
- 
getMinimumpublic int getMinimum()Returns the minumum value.- Returns:
- the minimum
- See Also:
 
- 
getMaximumpublic int getMaximum()Returns the maximum value.- Returns:
- the maximum
- See Also:
 
- 
getPageDownReturns the figure used for page down.- Returns:
- the page down figure
 
- 
getPageIncrementpublic int getPageIncrement()Returns the the amound the scrollbar will move when the page up or page down areas are pressed.- Returns:
- the page increment
 
- 
getPageUpReturns the figure used for page up.- Returns:
- the page up figure
 
- 
getRangeModelReturns the range model for this scrollbar.- Returns:
- the range model
 
- 
getStepIncrementpublic int getStepIncrement()Returns the amount the scrollbar will move when the up or down arrow buttons are pressed.- Returns:
- the step increment
 
- 
getThumbReturns the figure used as the scrollbar's thumb.- Returns:
- the thumb figure
 
- 
getValuepublic int getValue()Returns the current scroll position of the scrollbar.- Returns:
- the current value
- See Also:
 
- 
getValueRangeprotected int getValueRange()Returns the size of the range of allowable values.- Returns:
- the value range
 
- 
initializeprotected void initialize()Initilization of the ScrollBar. Sets the Scrollbar to have a ScrollBarLayout with vertical orientation. Creates the Figures that make up the components of the ScrollBar.- Since:
- 2.0
 
- 
isHorizontalpublic boolean isHorizontal()Returnstrueif this scrollbar is orientated horizontally,falseotherwise.- Returns:
- whether this scrollbar is horizontal
 
- 
propertyChange- Specified by:
- propertyChangein interface- PropertyChangeListener
- See Also:
 
- 
revalidatepublic void revalidate()Description copied from interface:IFigureInvalidates this figure and revalidates() its parent. If a figure does not have a parent, it will request a validation from it UpdateManager. Calling this method does not guarantee that a repaint will occur.- Specified by:
- revalidatein interface- IFigure
- Overrides:
- revalidatein class- Figure
- See Also:
 
- 
setDirectionpublic void setDirection(int direction) Does nothing because this doesn't make sense for a scrollbar.- Specified by:
- setDirectionin interface- Orientable
- Parameters:
- direction- The direction
- See Also:
 
- 
setDownClickableSets the Clickable that represents the down arrow of the Scrollbar to down.- Parameters:
- down- the down button
- Since:
- 2.0
 
- 
setUpClickableSets the Clickable that represents the up arrow of the Scrollbar to up.- Parameters:
- up- the up button
- Since:
- 2.0
 
- 
setEnabledpublic void setEnabled(boolean value) Description copied from interface:IFigureSets this IFigure to be enabled.- Specified by:
- setEnabledin interface- IFigure
- Overrides:
- setEnabledin class- Figure
- Parameters:
- value-- trueif this IFigure should be enabled
- See Also:
 
- 
setExtentpublic void setExtent(int ext) Sets the extent of the Scrollbar to ext- Parameters:
- ext- the extent
- Since:
- 2.0
 
- 
setHorizontalpublic final void setHorizontal(boolean value) Sets the orientation of the ScrollBar. Iftrue, the Scrollbar will have a horizontal orientation. Iffalse, the scrollBar will have a vertical orientation.- Parameters:
- value-- trueif the scrollbar should be horizontal
- Since:
- 2.0
 
- 
setMaximumpublic void setMaximum(int max) Sets the maximum position to max.- Parameters:
- max- the maximum position
- Since:
- 2.0
 
- 
setMinimumpublic void setMinimum(int min) Sets the minimum position to min.- Parameters:
- min- the minumum position
- Since:
- 2.0
 
- 
setOrientationpublic void setOrientation(int value) Description copied from interface:OrientableSets the orientation. Can be eitherOrientable.HORIZONTALorOrientable.VERTICAL.- Specified by:
- setOrientationin interface- Orientable
- Parameters:
- value- The orientation
- See Also:
 
- 
setPageIncrementpublic void setPageIncrement(int increment) Sets the ScrollBar to scroll increment pixels when its pageup or pagedown buttons are pressed. (Note that the pageup and pagedown buttons are NOT the arrow buttons, they are the figures between the arrow buttons and the ScrollBar's thumb figure).- Parameters:
- increment- the new page increment
- Since:
- 2.0
 
- 
setPageDownSets the pagedown button to the passed Clickable. The pagedown button is the figure between the down arrow button and the ScrollBar's thumb figure.- Parameters:
- down- the page down figure
- Since:
- 2.0
 
- 
setPageUpSets the pageup button to the passed Clickable. The pageup button is the rectangular figure between the down arrow button and the ScrollBar's thumb figure.- Parameters:
- up- the page up figure
- Since:
- 2.0
 
- 
setRangeModelSets the ScrollBar's RangeModel to the passed value.- Parameters:
- rangeModel- the new range model
- Since:
- 2.0
 
- 
setStepIncrementpublic void setStepIncrement(int increment) Sets the ScrollBar's step increment to the passed value. The step increment indicates how many pixels the ScrollBar will scroll when its up or down arrow button is pressed.- Parameters:
- increment- the new step increment
- Since:
- 2.0
 
- 
setThumbSets the ScrollBar's thumb to the passed Figure. The thumb is the draggable component of the ScrollBar that indicates the ScrollBar's position.- Parameters:
- figure- the thumb figure
- Since:
- 2.0
 
- 
setValuepublic void setValue(int v) Sets the value of the Scrollbar to v- Parameters:
- v- the new value
- Since:
- 2.0
 
- 
stepDownprotected void stepDown()Causes the ScrollBar to scroll down (or right) by the value of its step increment.- Since:
- 2.0
 
- 
stepUpprotected void stepUp()Causes the ScrollBar to scroll up (or left) by the value of its step increment.- Since:
- 2.0
 
 
-