Google Web Toolkit (Beta)
Search this site:

# Class DeckPanel

public class DeckPanel
extends ComplexPanel
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.

## Constructors

DeckPanel() | Creates an empty deck panel.

## Methods

add(Widget) | Adds the specified widget to the deck.
disown(Widget) | Calls the superclass' `disown(Widget)` method, makes the widget visible, and clears the widget's width and height attributes.
getVisibleWidget() | Gets the index of the currently-visible widget.
insert(Widget, int) | Inserts a widget before the specified index.
remove(Widget) |
showWidget(int) | Shows the widget at the specified index.

## 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.

#### Parameters

w
  the widget to be added

### disown

protected void disown(Widget w)
Calls the superclass' `disown(Widget)` method, makes the widget visible, and clears the widget's width and height attributes. This is done so that any changes to the visibility, height, or width of the widget that were done by the panel are undone when the widget is disowned from the panel.

#### Parameters

w
  the widget to be disowned

### getVisibleWidget

public int getVisibleWidget()
Gets the index of the currently-visible widget.

#### Return Value

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

### remove

public boolean remove(Widget w)

#### Parameters

w

### 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