Class ScrollPanel

public class ScrollPanel
extends SimplePanel
implements SourcesScrollEvents
A simple panel that wraps its contents in a scrollable area.

Constructors

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

Methods

addScrollListener(ScrollListener)Adds a listener interface to receive scroll events.
ensureVisible(UIObject)Ensures that the specified item is visible, by adjusting the panel's scroll position.
getHorizontalScrollPosition()Gets the horizontal scroll position.
getScrollPosition()Gets the vertical scroll position.
onBrowserEvent(Event)
removeScrollListener(ScrollListener)Removes a previously added scroll listener.
setAlwaysShowScrollBars(boolean)Sets whether this panel always shows its scroll bars, or only when necessary.
setHorizontalScrollPosition(int)Sets the horizontal scroll position.
setScrollPosition(int)Sets the vertical scroll position.

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)
Adds a listener interface to receive scroll events.

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.

Return Value

the horizontal scroll position, in pixels

getScrollPosition

public int getScrollPosition()
Gets the vertical scroll position.

Return Value

the vertical scroll position, in pixels

onBrowserEvent

public void onBrowserEvent(Event event)

Parameters

event

removeScrollListener

public void removeScrollListener(ScrollListener listener)
Removes a previously added scroll listener.

Parameters

listener
the listener interface to remove.

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

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