mlsoft.mct.MlTabPanel

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.

Beans Properties/Global Resources

Name                   Type               Default
activeTabNum           Integer            -1
autoSelect             Boolean            true
blankBackground        Color              #C0C0C0
bottomShadowColor      Color              #282828
cornerDimension        Integer            2
cornerStyle            Integer            CORNER_ARC
debugLevel             Integer            0
highlightColor         Color              #000000
highlightThickness     Integer            1
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           Integer            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.

Tab Resources

TabPanel defines the resources in the table below affecting individual tabs. A setValues() call can set values for an individual tab by specifying 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.

Events

Tab select events may be received by implementing a MlTabPanelListener interface and using addMlTabPanelListener() to add an object as an event receiver. Consult the MlTabPanelListener reference page for the interface you must implement and the MlTabPanelEvent page for detail on the event received.

Using the JDK 1.1, you may receive this event in an processEvent() routine or in processMlTabPanelEvent() in the subclass of the MlTabPanel.

Public Methods

public Component add(String name, Component comp)
public Component add(String name, Image image, Component comp)
public 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 parameter defines the page name of the tab. If no pageName is given, the pageName will be set to the name passed which will also be used for the tab's label. The pageName of a tab is used to uniquely identify the tab (even if the text inside the tab changes). The tabLabel, if specified, is the label to display in the tab and tabImage, if specified, defines an Image to appear in the tab. Either of these values may be null.

public Component addTab(String name)
public Component addTab(String name, Image image)

Adds a tab containing a label and an image, if specified. The name passed defines the tab's label as well as the page name of the tab.

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. You can set a value for a tab by specifying the pageName of the tab in a MlResources object and calling the setValues() method.

public void remove(String pageName)
public void remove(int position)
Removes the tab and any component managed by the tab for the given pageName or position.

public void showPage(String pageName)
public void showPage(String pageName, boolean notify)
public void showPage(int position, boolean notify)

Shows the page with the pageName or position given. If notify is not passed or if notify is passed and is true, an ACTION_EVENT will be posted if the newly activated page is not the same as the current active page. If notify is passed and is false, no event will be posted.