Home » GWT StackLayoutPanel

GWT StackLayoutPanel

by Online Tutorials Library

GWT StackLayoutPanel

In GWT StackLayoutPanel, only one child is displayed vertically at a time. All other child widget creates their header and arranges themselves at bottom of panel. We can view child widget by clicking on their header.

GWT StackLayoutPanel Class Declaration

Let’s see the declaration of com.google.gwt.user.client.ui.StackLayoutPanel

GWT StackLayoutPanel Constructor

Constructor Description
StackLayoutPanel(Style.Unit unit) It creates an empty stack panel.

StackLayoutPanel Common Methods

Modifier and Types Method Description
void add(IsWidget widget, IsWidget header, double headerSize) It is the overloaded version for IsWidget.
void add(Widget widget, SafeHtml header, double headerSize) It adds a child widget to this stack, along with a widget representing the stack header.
void add(Widget widget, java.lang.String header, boolean asHtml, double headerSize) It adds a child widget to this stack, along with a widget representing the stack header.
HandlerRegistration addBeforeSelectionHandler(BeforeSelectionHandler<java.lang.Integer> handler) It adds a BeforeSelectionEvent handler.
HandlerRegistration addSelectionHandler(SelectionHandler<java.lang.Integer> handler) It adds a SelectionEvent handler.
void animate(int duration) Its Layout children, animating over the specified period of time.
void clear() It removes all child widgets.
void forceLayout() It layout children immediately.
widget getHeaderWidget(int index) It gets the widget in the stack header at the given index.
widget getHeaderWidget(Widget child) It gets the widget in the stack header associated with the given child widget.
void insert(Widget child, SafeHtml html, double headerSize, int beforeIndex) It inserts a widget into the panel.
void insert(Widget child, java.lang.String text, boolean asHtml, double headerSize, int beforeIndex) It inserts a widget into the panel.
void setHeaderHTML(int index, java.lang.String html) It sets a stack header’s HTML contents.
void setHeaderText(int index, java.lang.String text) It sets a stack header’s text contents.
void showWidget(Widget child) It shows the specified widget and fires events.
void showWidget(Widget child, boolean fireEvents) It shows the specified widget.

GWT StackLayoutPanel Example 1

//SampleStackLayoutPanel.java

Output:

GWT StackLayoutPanel

GWT StackLayoutPanel Example 2

//SampleStackLayoutPanel.java

//SampleStackLayoutPanel.css

Output:

GWT StackLayoutPanel

Next TopicGWT UI Binder

You may also like