Google Web Toolkit (Beta)
Search this site:

# Class SimplePanel

public class SimplePanel
extends Panel
// Superclass of `ScrollPanel`, `PopupPanel`, `FormPanel`, `FocusPanel`
Abstract base class for panels that contain only one widget.

## Constructors

SimplePanel() | Creates an empty panel that uses a DIV for its contents.
SimplePanel(Element) | Creates an empty panel that uses the specified browser element for its contents.

## Methods

add(Widget) | Adds a widget to this panel.
getContainerElement() | Override this method to specify that an element other than the root element be the container for the panel's child widget.
getWidget() | Gets the panel's child widget.
iterator() | Gets an iterator for the contained widgets.
remove(Widget) | Removes a child widget.
setWidget(Widget) | Sets this panel's widget.

## Constructor Detail

### SimplePanel

public SimplePanel()
Creates an empty panel that uses a DIV for its contents.

### SimplePanel

protected SimplePanel(Element elem)
Creates an empty panel that uses the specified browser element for its contents.

#### Parameters

elem
  the browser element to use

## Method Detail

### add

public void add(Widget w)
Adds a widget to this panel.

#### Parameters

w
  the child widget to be added

### getContainerElement

protected Element getContainerElement()
Override this method to specify that an element other than the root element be the container for the panel's child widget. This can be useful when you want to create a simple panel that decorates its contents.

#### Return Value

the element to be used as the panel's container

### getWidget

public Widget getWidget()
Gets the panel's child widget.

#### Return Value

the child widget, or `null` if none is present

### iterator

public Iterator iterator()
Gets an iterator for the contained widgets. This iterator is required to implement Iterator.remove().

### remove

public boolean remove(Widget w)
Removes a child widget.

#### Parameters

w
  the widget to be removed

#### Return Value

`true` if the widget was present

### setWidget

public void setWidget(Widget w)
Sets this panel's widget. Any existing child widget will be removed.

#### Parameters

w
  the panel's new widget (`null` will clear the panel)