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

    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.ComplexPanel
                      com.google.gwt.user.client.ui.DeckPanel

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

    public class DeckPanel

extends ComplexPanel
implements HasAnimation

A panel that displays all of its child widgets in a 'deck', where only one can be visible at a time. It is used by `TabPanel`.

Once a widget has been added to a DeckPanel, its visibility, width, and height attributes will be manipulated. When the widget is removed from the DeckPanel, it will be visible, and its width and height attributes will be cleared.

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
`DeckPanel()` Creates an empty deck panel.

Method Summary
`void` | `add(Widget w)` Adds the specified widget to the deck.
`int` | `getVisibleWidget()` Gets the index of the currently-visible widget.
`void` | `insert(Widget w, int beforeIndex)` Inserts a widget before the specified index.
`boolean` | `isAnimationEnabled()`
`boolean` | `remove(Widget w)` Removes a child widget.
`void` | `setAnimationEnabled(boolean enable)` Enable or disable animations.
`void` | `showWidget(int index)` Shows the widget at the specified index.

Methods inherited from class com.google.gwt.user.client.ui.ComplexPanel
`add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, insert, insert, iterator, remove`

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

### DeckPanel

    public DeckPanel()

  Creates an empty deck panel.

Method Detail

### add

    public void add(Widget w)

  Adds the specified widget to the deck.

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

### getVisibleWidget

    public int getVisibleWidget()

  Gets the index of the currently-visible widget.

  Returns:
    the visible widget's index

### insert

    public void insert(Widget w,
                       int beforeIndex)

  Inserts a widget before the specified index.

  Parameters:
    `w` - the widget to be inserted
    `beforeIndex` - the index before which it will be inserted
  Throws:
    `java.lang.IndexOutOfBoundsException` - if `beforeIndex` is out of range

### isAnimationEnabled

    public boolean isAnimationEnabled()

  Specified by:
    `isAnimationEnabled` in interface `HasAnimation`
  Returns:
    true if animations are enabled, false if not

### 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`
  Overrides:
    `remove` in class `ComplexPanel`
  Parameters:
    `w` - the widget to be removed
  Returns:
    `true` if the child was present

### setAnimationEnabled

    public void setAnimationEnabled(boolean enable)

  Description copied from interface: `HasAnimation`
  Enable or disable animations.

  Specified by:
    `setAnimationEnabled` in interface `HasAnimation`
  Parameters:
    `enable` - true to enable, false to disable

### showWidget

    public void showWidget(int index)

  Shows the widget at the specified index. This causes the currently- visible widget to be hidden.

  Parameters:
    `index` - the index of the widget to be shown