## com.google.gwt.user.client.ui
Class ScrollPanel

    java.lang.Object
      com.google.gwt.user.client.ui.UIObject
          com.google.gwt.user.client.ui.Widget
              com.google.gwt.user.client.ui.Panel
                  com.google.gwt.user.client.ui.SimplePanel
                      com.google.gwt.user.client.ui.ScrollPanel

All Implemented Interfaces:
  EventListener, HasWidgets, SourcesScrollEvents, java.lang.Iterable<Widget>

    public class ScrollPanel

extends SimplePanel
implements SourcesScrollEvents

A simple panel that wraps its contents in a scrollable area.

Nested Class Summary

Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
`UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled`

Field Summary

Fields inherited from class com.google.gwt.user.client.ui.UIObject
`DEBUG_ID_PREFIX`

Constructor Summary
`ScrollPanel()` Creates an empty scroll panel.
`ScrollPanel(Widget child)` Creates a new scroll panel with the given child widget.

Method Summary
`void` `addScrollListener(ScrollListener listener)` Adds a listener interface to receive scroll events.
`void` `ensureVisible(UIObject item)` Ensures that the specified item is visible, by adjusting the panel's scroll position.
`int` `getHorizontalScrollPosition()` Gets the horizontal scroll position.
`int` `getScrollPosition()` Gets the vertical scroll position.
`void` `onBrowserEvent(Event event)` Fired whenever a browser event is received.
`void` `removeScrollListener(ScrollListener listener)` Removes a previously added scroll listener.
`void` `scrollToBottom()` Scroll to the bottom of this panel.
`void` `scrollToLeft()` Scroll to the far left of this panel.
`void` `scrollToRight()` Scroll to the far right of this panel.
`void` `scrollToTop()` Scroll to the top of this panel.
`void` `setAlwaysShowScrollBars(boolean alwaysShow)` Sets whether this panel always shows its scroll bars, or only when necessary.
`void` `setHeight(java.lang.String height)` Sets the object's height.
`void` `setHorizontalScrollPosition(int position)` Sets the horizontal scroll position.
`void` `setScrollPosition(int position)` Sets the vertical scroll position.
`void` `setSize(java.lang.String width, java.lang.String height)` Sets the object's size.
`void` `setWidth(java.lang.String width)` Sets the object's width.

Methods inherited from class com.google.gwt.user.client.ui.SimplePanel
`add, getContainerElement, getWidget, iterator, remove, setWidget`

Methods inherited from class com.google.gwt.user.client.ui.Panel
`adopt, adopt, clear, disown, doAttachChildren, doDetachChildren, onLoad, onUnload, orphan`

Methods inherited from class com.google.gwt.user.client.ui.Widget
`getParent, isAttached, onAttach, onDetach, removeFromParent`

Methods inherited from class com.google.gwt.user.client.ui.UIObject

`addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setPixelSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, sinkEvents, toString, unsinkEvents`

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

Constructor Detail

### ScrollPanel

    public ScrollPanel()

  Creates an empty scroll panel.

### ScrollPanel

    public ScrollPanel(Widget child)

  Creates a new scroll panel with the given child widget.

  Parameters:
    `child` - the widget to be wrapped by the scroll panel

Method Detail

### addScrollListener

    public void addScrollListener(ScrollListener listener)

  Description copied from interface: `SourcesScrollEvents`
  Adds a listener interface to receive scroll events.

  Specified by:
    `addScrollListener` in interface `SourcesScrollEvents`
  Parameters:
    `listener` - the listener interface to add.

### ensureVisible

    public void ensureVisible(UIObject item)

  Ensures that the specified item is visible, by adjusting the panel's scroll position.

  Parameters:
    `item` - the item whose visibility is to be ensured

### getHorizontalScrollPosition

    public int getHorizontalScrollPosition()

  Gets the horizontal scroll position.

  Returns:
    the horizontal scroll position, in pixels

### getScrollPosition

    public int getScrollPosition()

  Gets the vertical scroll position.

  Returns:
    the vertical scroll position, in pixels

### onBrowserEvent

    public void onBrowserEvent(Event event)

  Description copied from interface: `EventListener`
  Fired whenever a browser event is received.

  Specified by:
    `onBrowserEvent` in interface `EventListener`
  Overrides:
    `onBrowserEvent` in class `Widget`
  Parameters:
    `event` - the event received

### removeScrollListener

    public void removeScrollListener(ScrollListener listener)

  Description copied from interface: `SourcesScrollEvents`
  Removes a previously added scroll listener.

  Specified by:
    `removeScrollListener` in interface `SourcesScrollEvents`
  Parameters:
    `listener` - the listener interface to remove.

### scrollToBottom

    public void scrollToBottom()

  Scroll to the bottom of this panel.

### scrollToLeft

    public void scrollToLeft()

  Scroll to the far left of this panel.

### scrollToRight

    public void scrollToRight()

  Scroll to the far right of this panel.

### scrollToTop

    public void scrollToTop()

  Scroll to the top of this panel.

### setAlwaysShowScrollBars

    public void setAlwaysShowScrollBars(boolean alwaysShow)

  Sets whether this panel always shows its scroll bars, or only when necessary.

  Parameters:
    `alwaysShow` - `true` to show scroll bars at all times

### setHeight

    public void setHeight(java.lang.String height)

  Sets the object's height. This height does not include decorations such as border, margin, and padding.

  Overrides:
    `setHeight` in class `UIObject`
  Parameters:
    `height` - the object's new height, in absolute CSS units (e.g. "10px", "1em" but not "50%")

### setHorizontalScrollPosition

    public void setHorizontalScrollPosition(int position)

  Sets the horizontal scroll position.

  Parameters:
    `position` - the new horizontal scroll position, in pixels

### setScrollPosition

    public void setScrollPosition(int position)

  Sets the vertical scroll position.

  Parameters:
    `position` - the new vertical scroll position, in pixels

### setSize

    public void setSize(java.lang.String width,
                        java.lang.String height)

  Sets the object's size. This size does not include decorations such as border, margin, and padding.

  Overrides:
    `setSize` in class `UIObject`
  Parameters:
    `width` - the object's new width, in absolute CSS units (e.g. "10px", "1em", but not "50%")
    `height` - the object's new height, in absolute CSS units (e.g. "10px", "1em", but not "50%")

### setWidth

    public void setWidth(java.lang.String width)

  Sets the object's width. This width does not include decorations such as border, margin, and padding.

  Overrides:
    `setWidth` in class `UIObject`
  Parameters:
    `width` - the object's new width, in absolute CSS units (e.g. "10px", "1em", but not "50%")