buoy.widget

Class BTabbedPane


public class BTabbedPane
extends WidgetContainer

BTabbedPane is a WidgetContainer which arranges its child Widgets in a row.

In addition to the event types generated by all Widgets, BTabbedPanes generate the following event types:

Author:
Peter Eastman

Nested Class Summary

static class
BTabbedPane.TabPosition
This inner class represents a position for the tabs.

Field Summary

static BTabbedPane.TabPosition
BOTTOM
static BTabbedPane.TabPosition
LEFT
static BTabbedPane.TabPosition
RIGHT
static BTabbedPane.TabPosition
TOP

Constructor Summary

BTabbedPane()
Create a new BTabbedPane with the tabs along the top.
BTabbedPane(BTabbedPane.TabPosition pos)
Create a new TabbedContainer.

Method Summary

void
add(Widget widget, String tabName)
Add a Widget to this container.
void
add(Widget widget, String tabName, Icon image)
Add a Widget to this container.
void
add(Widget widget, String tabName, Icon image, int index)
Add a Widget to this container.
Widget
getChild(int i)
Get the i'th child of this container.
int
getChildCount()
Get the number of children in this container.
int
getChildIndex(Widget widget)
Get the index of a particular Widget.
Collection
getChildren()
Get a Collection containing all child Widgets of this container.
JTabbedPane
getComponent()
Get the java.awt.Component corresponding to this Widget.
int
getSelectedTab()
Get the index of the tab which is currently selected.
Icon
getTabImage(int index)
Get the image displayed on a particular tab.
String
getTabName(int index)
Get the name displayed on a particular tab.
BTabbedPane.TabPosition
getTabPosition()
Get the position of the tabs (TOP, LEFT, BOTTOM, or RIGHT).
void
layoutChildren()
Layout the child Widgets.
void
remove(Widget widget)
Remove a child Widget from this container.
void
remove(int index)
Remove a child Widget from this container.
void
removeAll()
Remove all child Widgets from this container.
void
setSelectedTab(int index)
Set which tab is selected.
void
setTabImage(int index, Icon image)
Set the image displayed on a particular tab.
void
setTabName(int index, String name)
Set the name displayed on a particular tab.
void
setTabPosition(BTabbedPane.TabPosition pos)
Set the position of the tabs (TOP, LEFT, BOTTOM, or RIGHT).

Methods inherited from class buoy.widget.WidgetContainer

getChildCount, getChildren, isOpaque, layoutChildren, remove, removeAll, setOpaque

Methods inherited from class buoy.widget.Widget

addEventLink, dispatchEvent, getBackground, getBounds, getComponent, getCursor, getFont, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, hasFocus, isEnabled, isFocusable, isVisible, repaint, requestFocus, setBackground, setCursor, setEnabled, setFocusable, setFont, setName, setVisible

Methods inherited from class buoy.event.EventSource

addEventLink, addEventLink, addEventLink, dispatchEvent, removeEventLink

Field Details

BOTTOM

public static final BTabbedPane.TabPosition BOTTOM

LEFT

public static final BTabbedPane.TabPosition LEFT

RIGHT

public static final BTabbedPane.TabPosition RIGHT

TOP

public static final BTabbedPane.TabPosition TOP

Constructor Details

BTabbedPane

public BTabbedPane()
Create a new BTabbedPane with the tabs along the top.

BTabbedPane

public BTabbedPane(BTabbedPane.TabPosition pos)
Create a new TabbedContainer.
Parameters:
pos - the position for the tabs (TOP, LEFT, BOTTOM, or RIGHT)

Method Details

add

public void add(Widget widget,
                String tabName)
Add a Widget to this container.
Parameters:
widget - the Widget to add
tabName - the name to display on the tab

add

public void add(Widget widget,
                String tabName,
                Icon image)
Add a Widget to this container.
Parameters:
widget - the Widget to add
tabName - the name to display on the tab
image - the image to display on the tab

add

public void add(Widget widget,
                String tabName,
                Icon image,
                int index)
Add a Widget to this container.
Parameters:
widget - the Widget to add
tabName - the name to display on the tab
image - the image to display on the tab
index - the position at which to add this tab

getChild

public Widget getChild(int i)
Get the i'th child of this container.

getChildCount

public int getChildCount()
Get the number of children in this container.
Overrides:
getChildCount in interface WidgetContainer

getChildIndex

public int getChildIndex(Widget widget)
Get the index of a particular Widget.
Parameters:
widget - the Widget to locate
Returns:
the position of the Widget within this container

getChildren

public Collection getChildren()
Get a Collection containing all child Widgets of this container.
Overrides:
getChildren in interface WidgetContainer

getComponent

public JTabbedPane getComponent()
Get the java.awt.Component corresponding to this Widget.
Overrides:
getComponent in interface Widget

getSelectedTab

public int getSelectedTab()
Get the index of the tab which is currently selected.

getTabImage

public Icon getTabImage(int index)
Get the image displayed on a particular tab.
Parameters:
index - the index of the tab

getTabName

public String getTabName(int index)
Get the name displayed on a particular tab.
Parameters:
index - the index of the tab

getTabPosition

public BTabbedPane.TabPosition getTabPosition()
Get the position of the tabs (TOP, LEFT, BOTTOM, or RIGHT).

layoutChildren

public void layoutChildren()
Layout the child Widgets. This may be invoked whenever something has changed (the size of this WidgetContainer, the preferred size of one of its children, etc.) that causes the layout to no longer be correct. If a child is itself a WidgetContainer, its layoutChildren() method will be called in turn.
Overrides:
layoutChildren in interface WidgetContainer

remove

public void remove(Widget widget)
Remove a child Widget from this container.
Overrides:
remove in interface WidgetContainer
Parameters:
widget - the Widget to remove

remove

public void remove(int index)
Remove a child Widget from this container.
Parameters:
index - the index of the Widget to remove

removeAll

public void removeAll()
Remove all child Widgets from this container.
Overrides:
removeAll in interface WidgetContainer

setSelectedTab

public void setSelectedTab(int index)
Set which tab is selected.
Parameters:
index - the index of the tab

setTabImage

public void setTabImage(int index,
                        Icon image)
Set the image displayed on a particular tab.
Parameters:
index - the index of the tab
image - the image to display

setTabName

public void setTabName(int index,
                       String name)
Set the name displayed on a particular tab.
Parameters:
index - the index of the tab
name - the name to display

setTabPosition

public void setTabPosition(BTabbedPane.TabPosition pos)
Set the position of the tabs (TOP, LEFT, BOTTOM, or RIGHT).

Written by Peter Eastman.