Class DeckPanel

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

Constructors

DeckPanel()Creates an empty deck panel.

Methods

add(Widget)Adds the specified widget to the deck.
getVisibleWidget()Gets the index of the currently-visible widget.
getWidget(int)Gets the child widget at the specified index.
getWidgetCount()Gets the number of child widgets in this panel.
getWidgetIndex(Widget)Gets the index of the specified child widget.
insert(Widget, int)Inserts a widget before the specified index.
remove(int)Removes the widget at 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

getVisibleWidget

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

Return Value

the visible widget's index

getWidget

public Widget getWidget(int index)
Gets the child widget at the specified index.

Parameters

index
the child widget's index

Return Value

the child widget

getWidgetCount

public int getWidgetCount()
Gets the number of child widgets in this panel.

Return Value

the number of children

getWidgetIndex

public int getWidgetIndex(Widget child)
Gets the index of the specified child widget.

Parameters

child
the widget to be found

Return Value

the widget's index, or -1 if it is not a child of this panel

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(int index)
Removes the widget at the specified index.

Parameters

index
the index of the widget to be removed

Return Value

false if the widget is not present

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