Component Container Panel MlPanel MlTabPanel
A TabPanel is a Panel with tabs along the top, bottom, left or right and a page area in the center. Tabs may contain images and/or text. Selecting tabs may automatically show a page from a stack in the page area or an application may change the contents of the page area as tabs are selected.
The resources defined below affect the TabPanel's overall layout and appearance. Definitions of resources affecting individual tabs follow the TabPanel resource definitions.
Name Type Default activeTabNum Integer -1 autoSelect Boolean true blankBackground Color #C0C0C0 bottomShadowColor Color #282828 cornerDimension Integer 2 cornerStyle CornerStyle CORNER_ARC debugLevel Integer 0 highlightColor Color #000000 highlightThickness Integer 2 imageMargin Integer 2 inactiveBackground Color #C0C0C0 inactiveForeground Color #000000 marginHeight Integer 1 marginWidth Integer 1 shadowThickness Integer 2 spacing Integer 0 tabBarHeight Integer 0 tabCount Integer 0 tabPlacement TabPlacement TABS_ON_TOP tabsPerRow Integer 0 topShadowColor Color #ffffff
activeTabNum
The position of the currently active tab. The first tab on the
left has a position of 0. If no tab is active, this value equals -1.
This resource is read-only.
autoSelect
If True (the default), the TabPanel will activate its first tab
when it is is is added to its parent. No event is generated by this
action. If false, no initial tab will be selected.
blankBackground
The color of the area between tabs, around tabs, and between
tabs and the edge of the TabPanel.
bottomShadowColor
The bottom color of the shadow around the TabPanel.
cornerDimension
If cornerStyle is CORNER_LINE, this value is used to determine
the length of the lines that clip the corners of the tabs. The
greater this value is, the longer the corner lines will be. If
cornerStyle is CORNER_ARC, this value is used to determine
the sizes of the arcs in the corners of the tabs. If cornerStyle
is CORNER_NONE, this resource has no effect.
cornerStyle
Defines the type of corners on the individual tabs. Possible values:
CORNER_NONE no corners CORNER_LINE corners are beveled CORNER_ARC corners are round
debugLevel
If set to a value greater than 0, debugging messages will be
printed to system output. When set to 0 (the default) only error
messages will be generated.
highlightColor
The color of the highlight drawn in the tab with focus.
highlightThickness
The thickness of the highlight drawn in the tab with focus.
imageMargin
The size of the margin between images in tabs and labels in tabs.
inactiveBackground
The background color of inactive tabs.
inactiveForeground
The foreground color of inactive tabs.
marginHeight
If tab placement is on the top or bottom, this value is the margin
between tab contents and the top of tabs, and between tab contents
and the bottom of tabs. If tab placement is on the left or right,
this value is the margin between tab contents and the left of tabs,
and between tab contents and the right of tabs.
marginWidth
If tab placement is on the top or bottom, this value is the margin
between tab contents and the left of tabs, and between tab contents
and the right of tabs. If tab placement is one the left
or right, this value is the margin between tab contents and the top of
tabs and between tab contents and bottoms of tabs.
shadowThickness
The thickness, in pixels, of the shadow draw around the TabPanel.
spacing
The amount of space between tabs.
tabBarHeight
The number of tabs displayed. This resource is read-only.
tabCount
The number of tabs displayed. This resource is read-only.
tabPlacement
Where to place the tabs. Possible values:
TABS_ON_TOP top left to right TABS_ON_BOTTOM bottom left to right TABS_ON_LEFT left top to bottom TABS_ON_RIGHT right top to bottom
tabsPerRow
If set to 0 (the default), the TabPanel will place tabs in a
single row one after another during layout. If non-zero,
this value specifies the number of rows of tabs to appear
in the TabPanel and the TabPanel will pad each row to the width
of the TabPanel by proportionally sizing the tabs based on
their contents and the width of the row.
topShadowColor
The top color of the shadow around the TabPanel.
TabPanel defines the resources in the table below affecting individual tabs. A setValues() call can set values for an individual tab by specifing the tab by its page name with the "tab" resource. If no individual tab is specified, all tabs resources will be affected by the call. Tab values may be retrieved with the getTabValue() method.
Name Type Default tab String null tabFont Font Helvetica 12 tabInactiveImage Image null tabImage Image null tabLabel String null
tab
This resource may be set to the page name of a tab to identify
a tab to set values for in a setValues() call.
tabFont
The font of the tab's label.
tabInactiveImage
The image to appear in the tab when the tab is inactive.
tabImage
The image to appear in tab when the tab is active.
tabLabel
The label to display in the tab.
TabPanel posts an ACTION_EVENT when a tab is activated. The Object parameter passed with the event is the page name (String format) of the selected tab.
public Component addTab(String name)
Adds a tab. The name passed defines the tab's label as well
as the page name of the tab.
public Component addTab(String name, Image image)
Adds a tab containing a label and an image.
The name passed defines the tab's label as well
as the page name of the tab.
public Component add(String name, Component comp)
Adds a tab managing the component comp.
The name passed defines the tab's label as well
as the page name of the tab. When the tab is selected, the given component
will be shown.
public synchronized Component add(String pageName, String tabLabel,
Image tabImage, Component comp)
Adds a tab managing the component comp. The comp parameter
may be null, in which case the tab will not manage any component.
The pageName parmaeter defines the page name of the tab. This
name is used to uniquely identify the tab. The tabLabel is the
label to display in the tab and tabImage defines an Image to
appear in the tab. Either of these values may be null.
public Object getTabValue(String pageName, String name)
Returns the value of the the tab resource for the tab with the
given pageName. The type of the value returned is determined
by the resource. Integer values will return as Integer objects,
boolean values as Boolean objects, etc.
public void remove(String pageName)
Removes the tab and any component managed by the tab for the given
pageName.
public synchronized void remove(int position)
Removes the tab and any component managed by the tab at the given
position in the TabPanel.
public void showPage(String pageName)
Shows the page with the pageName passed. An ACTION_EVENT
will be posted if the newly activated page is not the same as
the current active page.
public synchronized void showPage(String pageName,
boolean notify)
Shows the page with the pageName passed. If notify is
true, an ACTION_EVENT will be posted if the newly activated page
is not the same as the current active page.
public synchronized void showPage(int position, boolean notify)
Shows the page at the given position. If notify is
true, an ACTION_EVENT will be posted if the newly activated page
is not the same as the current active page.