GWT ScrollPanel

GWT ScrollPanel wraps the content into a scrollable area. We can create different types of scroll panel using ScrollPanel constructors. This class is located into com.google.gwt.user.client.ui.ScrollPanel package.

GWT ScrollPanel Class Declaration

GWT ScrollPanel Constructors

ConstructorDescription
ScrollPanel()It creates an empty scroll panel.
ScrollPanel(Element root, Element scrollable, Element container)It creates an empty scroll panel using the specified root, scrollable, and container elements.
ScrollPanel(Widget child)It creates a new scroll panel with the given child widget.

GWT ScrollPanel Common Methods

Modifier and TypesMethodDescription
voidensureVisible(UIObject item)It ensures that the specified item is visible, by adjusting the panel's scroll position.
intgetHorizontalScrollPosition()It gets the horizontal scroll position.
protected ElementgetContainerElement()It override this method to specify that an element other than the root element be the container for the panel's child widget.
intgetHorizontalScrollPosition()It gets the horizontal scroll position.
intgetMaximumHorizontalScrollPosition()It get the maximum position of horizontal scrolling.
booleanisTouchScrollingDisabled()It check whether or not touch based scrolling is disabled.
protected voidonAttach()This method is called when a widget is attached to the browser's document.
voidsetHorizontalScrollPosition(int position)td>It sets the horizontal scroll position.
voidsetSize(java.lang.String width, java.lang.String height)It sets the object's size.
voidsetVerticalScrollPosition(int position)It sets the vertical scroll position.

GWT ScrollPanel Example

//SampleScrollPanel.java

Output:

GWT Scroll Panel
Next TopicGWT Grid




Latest Courses