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

    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

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

Direct Known Subclasses:
  DecoratorPanel, FocusPanel, FormPanel, LazyPanel, PopupPanel, ScrollPanel

    public class SimplePanel

extends Panel

Base class for panels that contain only one widget.

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
`` | `SimplePanel()` Creates an empty panel that uses a DIV for its contents.
`protected` | `SimplePanel(Element elem)` Creates an empty panel that uses the specified browser element for its contents.

Method Summary
`void` | `add(Widget w)` Adds a widget to this panel.
`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.
`Widget` | `getWidget()` Gets the panel's child widget.
`java.util.Iterator<Widget>` | `iterator()` Gets an iterator for the contained widgets.
`boolean` | `remove(Widget w)` Removes a child widget.
`void` | `setWidget(Widget w)` Sets this panel's widget.

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
`addDomHandler, addHandler, delegateEvent, fireEvent, getHandlerCount, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, removeFromParent, sinkEvents`

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, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, toString, unsinkEvents`

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

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.

  Specified by:
    `add` in interface `HasWidgets`
  Overrides:
    `add` in class `Panel`
  Parameters:
    `w` - the child widget to be added
  See Also:
    `HasWidgets.add(Widget)`

### getWidget

    public Widget getWidget()

  Gets the panel's child widget.

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

### iterator

    public java.util.Iterator<Widget> iterator()

  Description copied from interface: `HasWidgets`
  Gets an iterator for the contained widgets. This iterator is required to implement `Iterator.remove()`.

### remove

    public boolean remove(Widget w)

  Description copied from class: `Panel`
  Removes a child widget.

  How to Override this Method

  There are several important things that must take place in the correct order to properly remove a Widget from a Panel. Not all of these steps will be relevant to every Panel, but all of the steps must be considered.

  1. Validate: Make sure this Panel is actually the parent of the child Widget; return `false` if it is not.
  2. Orphan: Call `Panel.orphan(Widget)` first while the child Widget is still attached.
  3. Physical Detach: Adjust the DOM to account for the removal of the child Widget. The Widget's Element must be physically removed from the DOM.
  4. Logical Detach: Update the Panel's state variables to reflect the removal of the child Widget. Example: the Widget is removed from the Panel's `WidgetCollection`.

  Specified by:
    `remove` in interface `HasWidgets`
  Specified by:
    `remove` in class `Panel`
  Parameters:
    `w` - the widget to be removed
  Returns:
    `true` if the child 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, or `null` to clear the panel

### 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. Note that this method continues to return the `Element` class defined in the `User` module to maintain backwards compatibility.

  Returns:
    the element to be used as the panel's container