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

    java.lang.Object
      com.google.gwt.user.client.ui.UIObject
          com.google.gwt.user.client.ui.Widget
              com.google.gwt.user.client.ui.Panel

All Implemented Interfaces:
  EventListener, HasWidgets

Direct Known Subclasses:
  ComplexPanel, HTMLTable, SimplePanel, com.google.gwt.user.client.ui.SplitPanel

public abstract class Panel
extends Widget
implements HasWidgets

Abstract base class for all panels, which are widgets that can contain other widgets.

Constructor Summary
`Panel()`

Method Summary
`void` `add(Widget w)` Adds a child widget.
`protected void` `adopt(Widget w, Element container)` This method must be called as part of the add method of any panel.
`void` `clear()` Removes all child widgets.
`protected void` `disown(Widget w)` This method must be called whenever a Widget is removed.
`protected void` `onAttach()` This method is called when a widget is attached to the browser's document.
`protected void` `onDetach()` This method is called when a widget is detached from the browser's document.

Methods inherited from class com.google.gwt.user.client.ui.Widget
`getParent, isAttached, onBrowserEvent, onLoad, onUnload, removeFromParent, setElement`

Methods inherited from class com.google.gwt.user.client.ui.UIObject
`addStyleName, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getTitle, isVisible, isVisible, removeStyleName, resetStyleName, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setTitle, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents`

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

Methods inherited from interface com.google.gwt.user.client.ui.HasWidgets
`iterator, remove`

Constructor Detail

### Panel

    public Panel()

Method Detail

### add

    public void add(Widget w)

  Description copied from interface: `HasWidgets`
  Adds a child widget.

  Specified by:
    `add` in interface `HasWidgets`
  Parameters:
    `w` - the widget to be added

### clear

    public void clear()

  Description copied from interface: `HasWidgets`
  Removes all child widgets.

  Specified by:
    `clear` in interface `HasWidgets`

### adopt

    protected void adopt(Widget w,
                         Element container)

  This method must be called as part of the add method of any panel. It ensures that the Widget's parent is set properly, and that it is removed from any existing parent widget. It also attaches the child widget's DOM element to its new container, ensuring that this process occurs in the right order.

  Parameters:
    `w` - the widget to be adopted
    `container` - the element within which it will be contained

### disown

    protected void disown(Widget w)

  This method must be called whenever a Widget is removed. It ensures that the Widget's parent is cleared.

  Parameters:
    `w` - the widget to be disowned

### onAttach

    protected void onAttach()

  Description copied from class: `Widget`
  This method is called when a widget is attached to the browser's document. To receive notification after a Widget has been added from the document, override the `Widget.onLoad()` method.

  Subclasses that override this method must call `super.onAttach()` to ensure that the Widget has been attached to the underlying Element.

  Overrides:
    `onAttach` in class `Widget`

### onDetach

    protected void onDetach()

  Description copied from class: `Widget`
  This method is called when a widget is detached from the browser's document. To receive notification before a Widget is removed from the document, override the `Widget.onUnload()` method.

  Subclasses that override this method must call `super.onDetach()` to ensure that the Widget has been detached from the underlying Element. Failure to do so will result in application memeroy leaks due to circular references between DOM Elements and JavaScript objects.

  Overrides:
    `onDetach` in class `Widget`