- java.lang.Object
- 
- javafx.scene.control.Tab
 
- 
- All Implemented Interfaces:
- Styleable,- EventTarget
 
 @DefaultProperty("content") @IDProperty("id") public class Tab extends Object implements EventTarget, Styleable Tabs are placed within a TabPane, where each tab represents a single 'page'.Tabs can contain any Nodesuch as UI controls or groups of nodes added to a layout container.When the user clicks on a Tab in the TabPane the Tab content becomes visible to the user. - Since:
- JavaFX 2.0
 
- 
- 
Property SummaryProperties Type Property Description BooleanPropertyclosableThe closable state for this tab.ObjectProperty<Node>contentThe content associated with the tab.ObjectProperty<ContextMenu>contextMenuThe context menu associated with the tab.ReadOnlyBooleanPropertydisabledIndicates whether or not thisTabis disabled.BooleanPropertydisableSets the disabled state of this tab.ObjectProperty<Node>graphicThe graphic in the tab.StringPropertyidThe id of this tab.ObjectProperty<EventHandler<Event>>onClosedThe event handler that is associated with the tab when the tab is closed.ObjectProperty<EventHandler<Event>>onCloseRequestCalled when there is an external request to close thisTab.ObjectProperty<EventHandler<Event>>onSelectionChangedThe event handler that is associated with a selection on the tab.ReadOnlyBooleanPropertyselectedThe currently selected tab.StringPropertystyleThe CSS style string associated to this tab.ReadOnlyObjectProperty<TabPane>tabPaneThe TabPane that contains this tab.StringPropertytextThe text shown in the tab.ObjectProperty<Tooltip>tooltipThe tooltip associated with this tab.
 - 
Field SummaryFields Modifier and Type Field Description static EventType<Event>CLOSED_EVENTCalled when a user closes this tab.static EventType<Event>SELECTION_CHANGED_EVENTCalled when the tab becomes selected or unselected.static EventType<Event>TAB_CLOSE_REQUEST_EVENTCalled when there is an external request to close thisTab.
 - 
Method SummaryModifier and Type Method Description EventDispatchChainbuildEventDispatchChain(EventDispatchChain tail)Construct an event dispatch chain for this target.BooleanPropertyclosableProperty()The closable state for this tab.ObjectProperty<Node>contentProperty()The content associated with the tab.ObjectProperty<ContextMenu>contextMenuProperty()The context menu associated with the tab.ReadOnlyBooleanPropertydisabledProperty()Indicates whether or not thisTabis disabled.BooleanPropertydisableProperty()Sets the disabled state of this tab.static List<CssMetaData<? extends Styleable,?>>getClassCssMetaData()NodegetContent()The content associated with the tab.ContextMenugetContextMenu()The context menu associated with the tab.List<CssMetaData<? extends Styleable,?>>getCssMetaData()The CssMetaData of this Styleable.NodegetGraphic()The graphic shown in the tab.StringgetId()The id of this tab.EventHandler<Event>getOnClosed()The event handler that is associated with the tab when the tab is closed.EventHandler<Event>getOnCloseRequest()Gets the value of the property onCloseRequest.EventHandler<Event>getOnSelectionChanged()The event handler that is associated with a selection on the tab.ObservableMap<Object,Object>getProperties()Returns an observable map of properties on this Tab for use primarily by application developers.ObservableSet<PseudoClass>getPseudoClassStates()Return the pseudo-class state of this Styleable.StringgetStyle()The CSS style string associated to this tab.StyleablegetStyleableParent()Return the parent of this Styleable, or null if there is no parent.ObservableList<String>getStyleClass()A list of String identifiers which can be used to logically group Nodes, specifically for an external style engine.TabPanegetTabPane()A reference to the TabPane that contains this tab instance.StringgetText()The text shown in the tab.TooltipgetTooltip()The tooltip associated with this tab.StringgetTypeSelector()The type of thisStyleablethat is to be used in selector matching.ObjectgetUserData()Returns a previously set Object property, or null if no such property has been set using thesetUserData(java.lang.Object)method.ObjectProperty<Node>graphicProperty()The graphic in the tab.booleanhasProperties()Tests if this Tab has properties.StringPropertyidProperty()The id of this tab.booleanisClosable()Returnstrueif this tab is closable.booleanisDisable()Returnstrueif this tab is disable.booleanisDisabled()booleanisSelected()Represents whether this tab is the currently selected tab, To change the selected Tab usetabPane.getSelectionModel().select()ObjectProperty<EventHandler<Event>>onClosedProperty()The event handler that is associated with the tab when the tab is closed.ObjectProperty<EventHandler<Event>>onCloseRequestProperty()Called when there is an external request to close thisTab.ObjectProperty<EventHandler<Event>>onSelectionChangedProperty()The event handler that is associated with a selection on the tab.ReadOnlyBooleanPropertyselectedProperty()The currently selected tab.voidsetClosable(boolean value)Setstrueif the tab is closable.voidsetContent(Node value)The content to show within the main TabPane area.voidsetContextMenu(ContextMenu value)Specifies the context menu to show when the user right-clicks on the tab.voidsetDisable(boolean value)Sets the disabled state of this tab.voidsetGraphic(Node value)Sets the graphic to show in the tab to allow the user to differentiate between the function of each tab.voidsetId(String value)Sets the id of this tab.voidsetOnClosed(EventHandler<Event> value)Defines a function to be called when the tab is closed.voidsetOnCloseRequest(EventHandler<Event> value)Sets the value of the property onCloseRequest.voidsetOnSelectionChanged(EventHandler<Event> value)Defines a function to be called when a selection changed has occurred on the tab.voidsetStyle(String value)A string representation of the CSS style associated with this tab.voidsetText(String value)Sets the text to show in the tab to allow the user to differentiate between the function of each tab.voidsetTooltip(Tooltip value)Specifies the tooltip to show when the user hovers over the tab.voidsetUserData(Object value)Convenience method for setting a single Object property that can be retrieved at a later date.StringPropertystyleProperty()The CSS style string associated to this tab.ReadOnlyObjectProperty<TabPane>tabPaneProperty()The TabPane that contains this tab.StringPropertytextProperty()The text shown in the tab.ObjectProperty<Tooltip>tooltipProperty()The tooltip associated with this tab.- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface javafx.css.StyleablegetStyleableNode
 
- 
 
- 
- 
- 
Property Detail- 
idpublic final StringProperty idProperty The id of this tab.- Returns:
- the id property of this tab
 
 - 
stylepublic final StringProperty styleProperty The CSS style string associated to this tab.- See Also:
- getStyle(),- setStyle(String)
 
 - 
selectedpublic final ReadOnlyBooleanProperty selectedProperty The currently selected tab.- See Also:
- isSelected()
 
 - 
tabPanepublic final ReadOnlyObjectProperty<TabPane> tabPaneProperty The TabPane that contains this tab.- See Also:
- getTabPane()
 
 - 
textpublic final StringProperty textProperty The text shown in the tab.- See Also:
- getText(),- setText(String)
 
 - 
graphicpublic final ObjectProperty<Node> graphicProperty The graphic in the tab.- See Also:
- getGraphic(),- setGraphic(Node)
 
 - 
contentpublic final ObjectProperty<Node> contentProperty The content associated with the tab. - See Also:
- getContent(),- setContent(Node)
 
 - 
contextMenupublic final ObjectProperty<ContextMenu> contextMenuProperty The context menu associated with the tab.- See Also:
- getContextMenu(),- setContextMenu(ContextMenu)
 
 - 
closablepublic final BooleanProperty closableProperty The closable state for this tab.- See Also:
- isClosable(),- setClosable(boolean)
 
 - 
onSelectionChangedpublic final ObjectProperty<EventHandler<Event>> onSelectionChangedProperty The event handler that is associated with a selection on the tab.
 - 
onClosedpublic final ObjectProperty<EventHandler<Event>> onClosedProperty The event handler that is associated with the tab when the tab is closed.- See Also:
- getOnClosed(),- setOnClosed(EventHandler)
 
 - 
tooltippublic final ObjectProperty<Tooltip> tooltipProperty The tooltip associated with this tab.- See Also:
- getTooltip(),- setTooltip(Tooltip)
 
 - 
disablepublic final BooleanProperty disableProperty Sets the disabled state of this tab. A disable tab is no longer interactive or traversable, but the contents remain interactive. A disable tab can be selected usingTabPane.getSelectionModel().- Default value:
- false
- Since:
- JavaFX 2.2
- See Also:
- isDisable(),- setDisable(boolean)
 
 - 
disabledpublic final ReadOnlyBooleanProperty disabledProperty Indicates whether or not thisTabis disabled. ATabwill become disabled ifdisableis set totrueon either itself or if theTabPaneis disabled.- Default value:
- false
- Since:
- JavaFX 2.2
- See Also:
- isDisabled()
 
 - 
onCloseRequestpublic final ObjectProperty<EventHandler<Event>> onCloseRequestProperty Called when there is an external request to close thisTab. The installed event handler can prevent tab closing by consuming the received event.- Since:
- JavaFX 8.0
- See Also:
- getOnCloseRequest(),- setOnCloseRequest(EventHandler)
 
 
- 
 - 
Constructor Detail- 
Tabpublic Tab() Creates a tab with no title.
 - 
Tabpublic Tab(String text) Creates a tab with a text title.- Parameters:
- text- The title of the tab.
 
 
- 
 - 
Method Detail- 
setIdpublic final void setId(String value) Sets the id of this tab. This simple string identifier is useful for finding a specific Tab within theTabPane. The default value isnull.- Parameters:
- value- the id of this tab
 
 - 
getIdpublic final String getId() The id of this tab.
 - 
idPropertypublic final StringProperty idProperty() The id of this tab.- Returns:
- the id property of this tab
 
 - 
setStylepublic final void setStyle(String value) A string representation of the CSS style associated with this tab. This is analogous to the "style" attribute of an HTML element. Note that, like the HTML style attribute, this variable contains style properties and values and not the selector portion of a style rule.Parsing this style might not be supported on some limited platforms. It is recommended to use a standalone CSS file instead. - Parameters:
- value- the style string
 
 - 
getStylepublic final String getStyle() The CSS style string associated to this tab.
 - 
stylePropertypublic final StringProperty styleProperty() The CSS style string associated to this tab.- See Also:
- getStyle(),- setStyle(String)
 
 - 
isSelectedpublic final boolean isSelected() Represents whether this tab is the currently selected tab, To change the selected Tab use tabPane.getSelectionModel().select()- Returns:
- true if selected
 
 - 
selectedPropertypublic final ReadOnlyBooleanProperty selectedProperty() The currently selected tab.- See Also:
- isSelected()
 
 - 
getTabPanepublic final TabPane getTabPane() A reference to the TabPane that contains this tab instance. - Returns:
- the TabPane
 
 - 
tabPanePropertypublic final ReadOnlyObjectProperty<TabPane> tabPaneProperty() The TabPane that contains this tab.- See Also:
- getTabPane()
 
 - 
setTextpublic final void setText(String value) Sets the text to show in the tab to allow the user to differentiate between the function of each tab. The text is always visible - Parameters:
- value- the text string
 
 - 
getTextpublic final String getText() The text shown in the tab.- Returns:
- The text shown in the tab.
 
 - 
textPropertypublic final StringProperty textProperty() The text shown in the tab.- See Also:
- getText(),- setText(String)
 
 - 
setGraphicpublic final void setGraphic(Node value) Sets the graphic to show in the tab to allow the user to differentiate between the function of each tab. By default the graphic does not rotate based on the TabPane.tabPosition value, but it can be set to rotate by setting TabPane.rotateGraphic to true. - Parameters:
- value- the graphic node
 
 - 
getGraphicpublic final Node getGraphic() The graphic shown in the tab.- Returns:
- The graphic shown in the tab.
 
 - 
graphicPropertypublic final ObjectProperty<Node> graphicProperty() The graphic in the tab.- See Also:
- getGraphic(),- setGraphic(Node)
 
 - 
setContentpublic final void setContent(Node value) The content to show within the main TabPane area. The content can be any Node such as UI controls or groups of nodes added to a layout container. - Parameters:
- value- the content node
 
 - 
getContentpublic final Node getContent() The content associated with the tab. - Returns:
- The content associated with the tab.
 
 - 
contentPropertypublic final ObjectProperty<Node> contentProperty() The content associated with the tab. - See Also:
- getContent(),- setContent(Node)
 
 - 
setContextMenupublic final void setContextMenu(ContextMenu value) Specifies the context menu to show when the user right-clicks on the tab. - Parameters:
- value- the context menu
 
 - 
getContextMenupublic final ContextMenu getContextMenu() The context menu associated with the tab.- Returns:
- The context menu associated with the tab.
 
 - 
contextMenuPropertypublic final ObjectProperty<ContextMenu> contextMenuProperty() The context menu associated with the tab.- See Also:
- getContextMenu(),- setContextMenu(ContextMenu)
 
 - 
setClosablepublic final void setClosable(boolean value) Sets trueif the tab is closable. If this is set tofalse, then regardless of the TabClosingPolicy, it will not be possible for the user to close this tab. Therefore, when this property isfalse, no 'close' button will be shown on the tab. The default istrue.- Parameters:
- value- the closable value
 
 - 
isClosablepublic final boolean isClosable() Returnstrueif this tab is closable.- Returns:
- trueif the tab is closable.
 
 - 
closablePropertypublic final BooleanProperty closableProperty() The closable state for this tab.- See Also:
- isClosable(),- setClosable(boolean)
 
 - 
setOnSelectionChangedpublic final void setOnSelectionChanged(EventHandler<Event> value) Defines a function to be called when a selection changed has occurred on the tab.- Parameters:
- value- the on selection changed event handler
 
 - 
getOnSelectionChangedpublic final EventHandler<Event> getOnSelectionChanged() The event handler that is associated with a selection on the tab.- Returns:
- The event handler that is associated with a tab selection.
 
 - 
onSelectionChangedPropertypublic final ObjectProperty<EventHandler<Event>> onSelectionChangedProperty() The event handler that is associated with a selection on the tab.
 - 
setOnClosedpublic final void setOnClosed(EventHandler<Event> value) Defines a function to be called when the tab is closed.- Parameters:
- value- the on closed event handler
 
 - 
getOnClosedpublic final EventHandler<Event> getOnClosed() The event handler that is associated with the tab when the tab is closed.- Returns:
- The event handler that is associated with the tab when the tab is closed.
 
 - 
onClosedPropertypublic final ObjectProperty<EventHandler<Event>> onClosedProperty() The event handler that is associated with the tab when the tab is closed.- See Also:
- getOnClosed(),- setOnClosed(EventHandler)
 
 - 
setTooltippublic final void setTooltip(Tooltip value) Specifies the tooltip to show when the user hovers over the tab. - Parameters:
- value- the tool tip value
 
 - 
getTooltippublic final Tooltip getTooltip() The tooltip associated with this tab.- Returns:
- The tooltip associated with this tab.
 
 - 
tooltipPropertypublic final ObjectProperty<Tooltip> tooltipProperty() The tooltip associated with this tab.- See Also:
- getTooltip(),- setTooltip(Tooltip)
 
 - 
setDisablepublic final void setDisable(boolean value) Sets the disabled state of this tab.- Default value:
- false
- Parameters:
- value- the state to set this tab
- Since:
- JavaFX 2.2
 
 - 
isDisablepublic final boolean isDisable() Returnstrueif this tab is disable.- Returns:
- true if this tab is disable
- Since:
- JavaFX 2.2
 
 - 
disablePropertypublic final BooleanProperty disableProperty() Sets the disabled state of this tab. A disable tab is no longer interactive or traversable, but the contents remain interactive. A disable tab can be selected usingTabPane.getSelectionModel().- Default value:
- false
- Since:
- JavaFX 2.2
- See Also:
- isDisable(),- setDisable(boolean)
 
 - 
isDisabledpublic final boolean isDisabled() - Returns:
- true if the TabPane is disabled
- Since:
- JavaFX 2.2
 
 - 
disabledPropertypublic final ReadOnlyBooleanProperty disabledProperty() Indicates whether or not thisTabis disabled. ATabwill become disabled ifdisableis set totrueon either itself or if theTabPaneis disabled.- Default value:
- false
- Since:
- JavaFX 2.2
- See Also:
- isDisabled()
 
 - 
onCloseRequestPropertypublic final ObjectProperty<EventHandler<Event>> onCloseRequestProperty() Called when there is an external request to close thisTab. The installed event handler can prevent tab closing by consuming the received event.- Since:
- JavaFX 8.0
- See Also:
- getOnCloseRequest(),- setOnCloseRequest(EventHandler)
 
 - 
getOnCloseRequestpublic EventHandler<Event> getOnCloseRequest() Gets the value of the property onCloseRequest.- Property description:
- Called when there is an external request to close this Tab. The installed event handler can prevent tab closing by consuming the received event.
- Since:
- JavaFX 8.0
 
 - 
setOnCloseRequestpublic void setOnCloseRequest(EventHandler<Event> value) Sets the value of the property onCloseRequest.- Property description:
- Called when there is an external request to close this Tab. The installed event handler can prevent tab closing by consuming the received event.
- Since:
- JavaFX 8.0
 
 - 
getPropertiespublic final ObservableMap<Object,Object> getProperties() Returns an observable map of properties on this Tab for use primarily by application developers.- Returns:
- an observable map of properties on this Tab for use primarily by application developers
- Since:
- JavaFX 2.2
 
 - 
hasPropertiespublic boolean hasProperties() Tests if this Tab has properties.- Returns:
- true if this tab has properties.
- Since:
- JavaFX 2.2
 
 - 
setUserDatapublic void setUserData(Object value) Convenience method for setting a single Object property that can be retrieved at a later date. This is functionally equivalent to calling the getProperties().put(Object key, Object value) method. This can later be retrieved by callinggetUserData().- Parameters:
- value- The value to be stored - this can later be retrieved by calling- getUserData().
- Since:
- JavaFX 2.2
 
 - 
getUserDatapublic Object getUserData() Returns a previously set Object property, or null if no such property has been set using thesetUserData(java.lang.Object)method.- Returns:
- The Object that was previously set, or null if no property has been set or if null was set.
- Since:
- JavaFX 2.2
 
 - 
getStyleClasspublic ObservableList<String> getStyleClass() A list of String identifiers which can be used to logically group Nodes, specifically for an external style engine. This variable is analogous to the "class" attribute on an HTML element and, as such, each element of the list is a style class to which this Node belongs.- Specified by:
- getStyleClassin interface- Styleable
- Returns:
- a list of String identifiers which can be used to logically group Nodes, specifically for an external style engine
- See Also:
- CSS3 class selectors
 
 - 
buildEventDispatchChainpublic EventDispatchChain buildEventDispatchChain(EventDispatchChain tail) Construct an event dispatch chain for this target. The event dispatch chain contains event dispatchers which might be interested in processing of events targeted at thisEventTarget. This event target is not automatically added to the chain, so if it wants to process events, it needs to add anEventDispatcherfor itself to the chain.In the case the event target is part of some hierarchy, the chain for it is usually built from event dispatchers collected from the root of the hierarchy to the event target. The event dispatch chain is constructed by modifications to the provided initial event dispatch chain. The returned chain should have the initial chain at its end so the dispatchers should be prepended to the initial chain. The caller shouldn't assume that the initial chain remains unchanged nor that the returned value will reference a different chain. - Specified by:
- buildEventDispatchChainin interface- EventTarget
- Parameters:
- tail- the initial chain to build from
- Returns:
- the resulting event dispatch chain for this target
 
 - 
getTypeSelectorpublic String getTypeSelector() The type of thisStyleablethat is to be used in selector matching. This is analogous to an "element" in HTML. (CSS Type Selector).- Specified by:
- getTypeSelectorin interface- Styleable
- Returns:
- "Tab"
- Since:
- JavaFX 8.0
 
 - 
getStyleableParentpublic Styleable getStyleableParent() Return the parent of this Styleable, or null if there is no parent.- Specified by:
- getStyleableParentin interface- Styleable
- Returns:
- getTabPane()
- Since:
- JavaFX 8.0
 
 - 
getPseudoClassStatespublic final ObservableSet<PseudoClass> getPseudoClassStates() Return the pseudo-class state of this Styleable. CSS assumes this set is read-only.- Specified by:
- getPseudoClassStatesin interface- Styleable
- Returns:
- the pseudo-class state
- Since:
- JavaFX 8.0
 
 - 
getCssMetaDatapublic List<CssMetaData<? extends Styleable,?>> getCssMetaData() The CssMetaData of this Styleable. This may be returned as an unmodifiable list.- Specified by:
- getCssMetaDatain interface- Styleable
- Returns:
- the CssMetaData
- Since:
- JavaFX 8.0
 
 - 
getClassCssMetaDatapublic static List<CssMetaData<? extends Styleable,?>> getClassCssMetaData() - Returns:
- The CssMetaData associated with this class, which may include the CssMetaData of its superclasses.
- Since:
- JavaFX 8.0
 
 
- 
 
-