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 by label and image properties.

By setting the closable property to true, a close button is shown for the tab, such that user could close the tab and the corresponding tab panel by clicking the button. Once user clicks on the close button, an onClose event is sent to the tab. It is processed by the onClose method of Tab. Then, onClose, by default, detaches the tab itself and the corresponding tab panel.

<tabbox width="400px">
    <tabs>    
        <tab label="Tab 1" image="/img/folder.gif" />        
        <tab label="Tab 2" image="/img/folder.gif" closable="true"/>        
    </tabs>    
    <tabpanels>    
        <tabpanel>This is panel 1</tabpanel>        
        <tabpanel>This is panel 2</tabpanel>        
    </tabpanels>    
</tabbox>

Class Name

org.zkoss.zul.Tab

Supported Child Components

*NONE

Supported Events

Event Name

Event Type

onClick

org.zkoss.zk.ui.event.MouseEvent

Description:

Denotes user has clicked the component.

onRightClick

org.zkoss.zk.ui.event.MouseEvent

Description:

Denotes user has right-clicked the component.

onDoubleClick

org.zkoss.zk.ui.event.MouseEvent

Description:

Denotes user has double-clicked the component.

onSelect

org.zkoss.zk.ui.event.SelectEvent

Description:

Denotes user has selected a tab. onSelect is sent to both tab and tabbox.

onClose

org.zkoss.ui.zk.ui.event.Event

Description:

Denotes the close button is pressed by a user, and the component shall detach itself.

Properties

Property

Description

Data Type

Default Value

closable

Sets whether this tab is closable. If closable, a button is displayed and the onClose event is sent if an user clicks the button.

Values : true|false

boolean

false

selected

Sets whether this tab is selected.

Values : true|false

boolean

Methods

Name

Description

Data Type

Values

getIndex

Returns the index of this panel, or -1 if it doesn't belong to any tabs.

int

getLinkedPanel

Returns the panel associated with this tab.

Tabpanel

getTabbox

Returns the tabbox owns this component.

Tabbox

isChildable

No child is allowed.

boolean

false

Inherited From