Eclipse Draw2d 3.3

## org.eclipse.draw2d
Class ScrollPane

    java.lang.Object
      org.eclipse.draw2d.Figure
          org.eclipse.draw2d.ScrollPane

All Implemented Interfaces:
  IFigure

public class ScrollPane
extends Figure

A class which implements automatic horizontal and/or vertical scrolling for a single IFigure child.

ScrollBar visibilites are represented by integer class constants:

- NEVER: Never show the ScrollBar
- AUTOMATIC: Show as needed, when the ScrollPane can no longer contain its view
- ALWAYS: Always show the ScrollBar

To use, instantiate a ScrollPane object and call its setView(IFigure) method passing the IFigure that is desired to have scrolling ability.

Nested Class Summary

Nested classes inherited from class org.eclipse.draw2d.Figure
`Figure.FigureIterator, Figure.IdentitySearch`

Nested classes inherited from class org.eclipse.draw2d.IFigure
`IFigure.NoInsets`

Field Summary
`static int` `ALWAYS` Constant indicating to always show the ScrollBar
`static int` `AUTOMATIC` Constant indicating to show as needed, when the ScrollPane can't contain its view
`protected ScrollBar` `hBar` The horizontal scrollbar
`static int` `NEVER` Constant indicating to never show the ScrollBar
`protected ScrollBar` `vBar` The vertical scrollbar
`protected Viewport` `viewport` The viewport being scrolled

Fields inherited from class org.eclipse.draw2d.Figure
`bgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTip`

Fields inherited from interface org.eclipse.draw2d.IFigure
`MAX_DIMENSION, MIN_DIMENSION, NO_INSETS`

Constructor Summary
`ScrollPane()` Constructs a new ScrollPane with a ScrollPaneLayout.

Method Summary
`protected void` `createHorizontalScrollBar()` Creates a new horizontally oriented ScrollBar and adds it to this ScrollPane.
`protected void` `createVerticalScrollBar()` Creates a new vertically oriented ScrollBar and adds it to this ScrollPane.
`protected void` `createViewport()` Creates a new Viewport and adds it to this ScrollPane.
`IFigure` `getContents()` Returns the contents of the viewport.
`ScrollBar` `getHorizontalScrollBar()` Returns the ScrollPane's horizontal ScrollBar.
`int` `getHorizontalScrollBarVisibility()` Returns the visibility of the ScrollPane's horizontal ScrollBar.
`ScrollBar` `getVerticalScrollBar()` Returns the ScrollPane's vertical ScrollBar.
`int` `getVerticalScrollBarVisibility()` Returns the visibility of the ScrollPane's vertical ScrollBar.
`IFigure` `getView()` Deprecated. use getContents()
`Viewport` `getViewport()` Returns the ScrollPane's `Viewport`.
`boolean` `isOpaque()` Returns true because ScrollPanes are always opaque.
`void` `scrollHorizontalTo(int x)` Scrolls the Scrollpane horizontally x pixels from its left-most position.
`void` `scrollTo(Point location)` Scrolls the Scrollpane horizontally from its left-most position by location.x pixels and vertically from its top-most position by location.y pixels.
`void` `scrollVerticalTo(int y)` Scrolls the Scrollpane vertically y pixels from its top-most position.
`void` `setContents(IFigure figure)` Sets the contents of the current viewport.
`void` `setHorizontalScrollBar(ScrollBar bar)` Sets the ScrollPane's horizontal ScrollBar to the passed ScrollBar.
`void` `setHorizontalScrollBarVisibility(int v)` Sets the horizontal ScrollBar visibility of the ScrollPane to the passed value.
`void` `setScrollBarVisibility(int v)` Sets both the horizontal and vertical ScrollBar visibilities of the ScrollPane to the passed value.
`void` `setVerticalScrollBar(ScrollBar bar)` Sets the ScrollPane's vertical ScrollBar to the passed Scrollbar.
`void` `setVerticalScrollBarVisibility(int v)` Sets the vertical ScrollBar visibility of the ScrollPane to the passed value.
`void` `setView(IFigure figure)` Deprecated. call setContents(IFigure) instead
`void` `setViewport(Viewport vp)` Sets the ScrollPane's Viewport to the passed value.
`void` `validate()` Indicates that this figure should make itself valid.

Methods inherited from class org.eclipse.draw2d.Figure

`add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireCoordinateSystemChanged, fireFigureMoved, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getClientArea, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, 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, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isMouseEventTarget, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, layout, paint, paintBorder, paintChildren, paintClientArea, paintFigure, primTranslate, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setConstraint, setCursor, setEnabled, setFlag, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setValid, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, useLocalCoordinates`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### NEVER

    public static final int NEVER

  Constant indicating to never show the ScrollBar

  See Also:
    Constant Field Values

### AUTOMATIC

    public static final int AUTOMATIC

  Constant indicating to show as needed, when the ScrollPane can't contain its view

  See Also:
    Constant Field Values

### ALWAYS

    public static final int ALWAYS

  Constant indicating to always show the ScrollBar

  See Also:
    Constant Field Values

### viewport

    protected Viewport viewport

  The viewport being scrolled

### hBar

    protected ScrollBar hBar

  The horizontal scrollbar

### vBar

    protected ScrollBar vBar

  The vertical scrollbar

Constructor Detail

### ScrollPane

    public ScrollPane()

  Constructs a new ScrollPane with a ScrollPaneLayout.

Since:
  2.0

Method Detail

### createHorizontalScrollBar

    protected void createHorizontalScrollBar()

  Creates a new horizontally oriented ScrollBar and adds it to this ScrollPane.

  Since:
    2.0

### createViewport

    protected void createViewport()

  Creates a new Viewport and adds it to this ScrollPane.

  Since:
    2.0

### createVerticalScrollBar

    protected void createVerticalScrollBar()

  Creates a new vertically oriented ScrollBar and adds it to this ScrollPane.

  Since:
    2.0

### getHorizontalScrollBar

    public ScrollBar getHorizontalScrollBar()

  Returns the ScrollPane's horizontal ScrollBar.

  Returns:
    the horizontal scrollbar
  Since:
    2.0

### getHorizontalScrollBarVisibility

    public int getHorizontalScrollBarVisibility()

  Returns the visibility of the ScrollPane's horizontal ScrollBar. These are represented by the integer class constants `NEVER`, `AUTOMATIC`, and `ALWAYS`. The default is `AUTOMATIC`.

  Returns:
    the visiblity of the horizontal scrollbar
  Since:
    2.0

### getVerticalScrollBar

    public ScrollBar getVerticalScrollBar()

  Returns the ScrollPane's vertical ScrollBar.

  Returns:
    teh vertical scrollbar
  Since:
    2.0

### getVerticalScrollBarVisibility

    public int getVerticalScrollBarVisibility()

  Returns the visibility of the ScrollPane's vertical ScrollBar. These are represented by the integer class constants `NEVER`, `AUTOMATIC`, and `ALWAYS`. The default is `AUTOMATIC`.

  Returns:
    the visibility of the vertical scrollbar
  Since:
    2.0

### getContents

    public IFigure getContents()

  Returns the contents of the viewport.

  Returns:
    the contents of the viewport

### getView

    public IFigure getView()

  Deprecated. use getContents()

  Returns the ScrollPane's view. The view is the IFigure that is the contents of the ScrollPane.

  Returns:
    the contents
  Since:
    2.0

### getViewport

    public Viewport getViewport()

  Returns the ScrollPane's `Viewport`.

  Returns:
    the viewport
  Since:
    2.0

### isOpaque

    public boolean isOpaque()

  Returns true because ScrollPanes are always opaque.

  Specified by:
    `isOpaque` in interface `IFigure`
  Overrides:
    `isOpaque` in class `Figure`
  See Also:
    `IFigure.isOpaque()`

### scrollHorizontalTo

    public void scrollHorizontalTo(int x)

  Scrolls the Scrollpane horizontally x pixels from its left-most position.

  Parameters:
    `x` - the amount to scroll horizontally
  Since:
    2.0

### scrollTo

    public void scrollTo(Point location)

  Scrolls the Scrollpane horizontally from its left-most position by location.x pixels and vertically from its top-most position by location.y pixels.

  Parameters:
    `location` - the point to scroll to
  Since:
    2.0

### scrollVerticalTo

    public void scrollVerticalTo(int y)

  Scrolls the Scrollpane vertically y pixels from its top-most position.

  Parameters:
    `y` - the amount to scroll vertically
  Since:
    2.0

### setContents

    public void setContents(IFigure figure)

  Sets the contents of the current viewport.

  Parameters:
    `figure` - the contents of the viewport

### setHorizontalScrollBar

    public void setHorizontalScrollBar(ScrollBar bar)

  Sets the ScrollPane's horizontal ScrollBar to the passed ScrollBar.

  Parameters:
    `bar` - the new horizontal scrollbar
  Since:
    2.0

### setHorizontalScrollBarVisibility

    public void setHorizontalScrollBarVisibility(int v)

  Sets the horizontal ScrollBar visibility of the ScrollPane to the passed value. These are represented by the integer class constants `NEVER`, `AUTOMATIC`, and `ALWAYS`. The default is `AUTOMATIC`.

  Parameters:
    `v` - the new horizontal visibility
  Since:
    2.0

### setScrollBarVisibility

    public void setScrollBarVisibility(int v)

  Sets both the horizontal and vertical ScrollBar visibilities of the ScrollPane to the passed value. These are represented by the integer class constants `NEVER`, `AUTOMATIC`, and `ALWAYS`. The default is `AUTOMATIC`.

  Parameters:
    `v` - the new vertical and horizontal visibility
  Since:
    2.0

### setVerticalScrollBar

    public void setVerticalScrollBar(ScrollBar bar)

  Sets the ScrollPane's vertical ScrollBar to the passed Scrollbar.

  Parameters:
    `bar` - the new vertical scrollbar
  Since:
    2.0

### setVerticalScrollBarVisibility

    public void setVerticalScrollBarVisibility(int v)

  Sets the vertical ScrollBar visibility of the ScrollPane to the passed value. These are represented by the integer class constants `NEVER`, `AUTOMATIC`, and `ALWAYS`. The default is `AUTOMATIC`.

  Parameters:
    `v` - the new vertical scrollbar visibility
  Since:
    2.0

### setView

    public void setView(IFigure figure)

  Deprecated. call setContents(IFigure) instead

  Sets the ScrollPane's view to the passed IFigure. The view is the top-level IFigure which represents the contents of the ScrollPane.

  Parameters:
    `figure` - the new contents
  Since:
    2.0

### setViewport

    public void setViewport(Viewport vp)

  Sets the ScrollPane's Viewport to the passed value.

  Parameters:
    `vp` - the new viewport
  Since:
    2.0

### validate

    public void validate()

  Description copied from interface: `IFigure`
  Indicates that this figure should make itself valid. Validation includes invoking layout on a LayoutManager if present, and then validating all children figures. Default validation uses pre-order, depth-first ordering.

  Specified by:
    `validate` in interface `IFigure`
  Overrides:
    `validate` in class `Figure`
  See Also:
    `IFigure.validate()`

Eclipse Draw2d 3.3

Copyright (c) IBM Corp. and others 2000, 2007. All Rights Reserved.