Components: tabbox, tabs, tab, tabpanels and tabpanel.
A tab box allows developers to separate a large number of components into several groups, and show one group each time, such that the user interface won't be too complicate to read. There is only one group (aka., a panel) is visible at the same time. Once the tab of an invisible group is clicked, it becomes visible and the previous visible group becomes invisible.
The generic syntax of tab boxes is as follows.
<tabbox> <tabs> <tab label="First"/> <tab label="Second"/> </tabs> <tabpanels> <tabpanel>The first panel.</tabpanel> <tabpanel>The second panel</tabpanel> </tabpanels> </tabbox>
tabbox: The outer box that contains the tabs and tab panels.
tabs: The container for the tabs, i.e., a collection of tab components.
tab: A specific tab. Clicking on the tab brings the tab panel to the front. You could put a label and an image on it.
tabpanels: The container for the tab panels, i.e., a collection of tabpanel components.
tabpanel: The body of a single tab panel. You would place the content for a group of components within a tab panel. The first tabpanel corresponds to the first tab, the second tabpanel corresponds to the second tab and so on.
The currently selected tab component is given an additional selected property which is set to true. This is used to give the currently selected tab a different appearance so that it will look selected. Only one tab will have a true value for this property at a time.
There are two way to change the selected tab by Java codes. They are equivalent as shown below.
tab1.setSelected(true); tabbox.setSelectedTab(tab1);
Of course, you can assign true to the selected property directly.
<tab label="My Tab" selected="true"/>
If none of tabs are selected, the first one is selected automatically.