- All Implemented Interfaces:
- Styleable,- EventTarget
Tabs are placed within a TabPane, where each tab represents a single
 'page'.
Tabs can contain any Node such 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 SummaryPropertiesTypePropertyDescriptionfinal BooleanPropertyThe closable state for this tab.final ObjectProperty<Node>The content associated with the tab.final ObjectProperty<ContextMenu>The context menu associated with the tab.final ReadOnlyBooleanPropertyIndicates whether or not thisTabis disabled.final BooleanPropertySets the disabled state of this tab.final ObjectProperty<Node>The graphic in the tab.final StringPropertyThe id of this tab.final ObjectProperty<EventHandler<Event>>The event handler that is associated with the tab when the tab is closed.final ObjectProperty<EventHandler<Event>>Called when there is an external request to close thisTab.final ObjectProperty<EventHandler<Event>>The event handler that is associated with a selection on the tab.final ReadOnlyBooleanPropertyThe currently selected tab.final StringPropertyThe CSS style string associated to this tab.final ReadOnlyObjectProperty<TabPane>The TabPane that contains this tab.final StringPropertyThe text shown in the tab.final ObjectProperty<Tooltip>The tooltip associated with this tab.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionCalled when a user closes this tab.Called when the tab becomes selected or unselected.Called when there is an external request to close thisTab.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionfinal <E extends Event>
 voidaddEventFilter(EventType<E> eventType, EventHandler<? super E> eventFilter) Registers an event filter for this target.final <E extends Event>
 voidaddEventHandler(EventType<E> eventType, EventHandler<? super E> eventHandler) Registers an event handler for this target.Construct an event dispatch chain for this target.final BooleanPropertyThe closable state for this tab.final ObjectProperty<Node>The content associated with the tab.final ObjectProperty<ContextMenu>The context menu associated with the tab.final ReadOnlyBooleanPropertyIndicates whether or not thisTabis disabled.final BooleanPropertySets the disabled state of this tab.static List<CssMetaData<? extends Styleable,?>> Gets theCssMetaDataassociated with this class, which may include theCssMetaDataof its superclasses.final NodeThe content associated with the tab.final ContextMenuThe context menu associated with the tab.List<CssMetaData<? extends Styleable,?>> The CssMetaData of this Styleable.final NodeThe graphic shown in the tab.final StringgetId()The id of this tab.final EventHandler<Event>The event handler that is associated with the tab when the tab is closed.Gets the value of theonCloseRequestproperty.final EventHandler<Event>The event handler that is associated with a selection on the tab.final ObservableMap<Object,Object> Returns an observable map of properties on this Tab for use primarily by application developers.final ObservableSet<PseudoClass>Return the pseudo-class state of this Styleable.final StringgetStyle()The CSS style string associated to this tab.Return the parent of this Styleable, or null if there is no parent.A list of String identifiers which can be used to logically group Nodes, specifically for an external style engine.final TabPaneA reference to the TabPane that contains this tab instance.final StringgetText()The text shown in the tab.final TooltipThe tooltip associated with this tab.The type of thisStyleablethat is to be used in selector matching.Returns a previously set Object property, or null if no such property has been set using thesetUserData(java.lang.Object)method.final ObjectProperty<Node>The graphic in the tab.booleanTests if this Tab has properties.final StringPropertyThe id of this tab.final booleanReturnstrueif this tab is closable.final booleanReturnstrueif this tab is disable.final booleanfinal booleanRepresents whether this tab is the currently selected tab, To change the selected Tab usetabPane.getSelectionModel().select()final ObjectProperty<EventHandler<Event>>The event handler that is associated with the tab when the tab is closed.final ObjectProperty<EventHandler<Event>>Called when there is an external request to close thisTab.final ObjectProperty<EventHandler<Event>>The event handler that is associated with a selection on the tab.final <E extends Event>
 voidremoveEventFilter(EventType<E> eventType, EventHandler<? super E> eventFilter) Unregisters a previously registered event filter from this target.final <E extends Event>
 voidremoveEventHandler(EventType<E> eventType, EventHandler<? super E> eventHandler) Unregisters a previously registered event handler from this target.final ReadOnlyBooleanPropertyThe currently selected tab.final voidsetClosable(boolean value) Setstrueif the tab is closable.final voidsetContent(Node value) The content to show within the main TabPane area.final voidsetContextMenu(ContextMenu value) Specifies the context menu to show when the user right-clicks on the tab.final voidsetDisable(boolean value) Sets the disabled state of this tab.final voidsetGraphic(Node value) Sets the graphic to show in the tab to allow the user to differentiate between the function of each tab.final voidSets the id of this tab.final voidsetOnClosed(EventHandler<Event> value) Defines a function to be called when the tab is closed.voidsetOnCloseRequest(EventHandler<Event> value) Sets the value of theonCloseRequestproperty.final voidsetOnSelectionChanged(EventHandler<Event> value) Defines a function to be called when a selection changed has occurred on the tab.final voidA string representation of the CSS style associated with this tab.final voidSets the text to show in the tab to allow the user to differentiate between the function of each tab.final 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.final StringPropertyThe CSS style string associated to this tab.final ReadOnlyObjectProperty<TabPane>The TabPane that contains this tab.final StringPropertyThe text shown in the tab.final ObjectProperty<Tooltip>The tooltip associated with this tab.Methods declared in class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods declared in interface javafx.css.StyleablegetStyleableNode
- 
Property Details- 
idThe id of this tab.- See Also:
 
- 
styleThe CSS style string associated to this tab.- See Also:
 
- 
selectedThe currently selected tab.- See Also:
 
- 
tabPaneThe TabPane that contains this tab.- See Also:
 
- 
textThe text shown in the tab.- See Also:
 
- 
graphicThe graphic in the tab.- See Also:
 
- 
contentThe content associated with the tab. - See Also:
 
- 
contextMenuThe context menu associated with the tab.
- 
closableThe closable state for this tab.
- 
onSelectionChangedThe event handler that is associated with a selection on the tab.
- 
onClosedThe event handler that is associated with the tab when the tab is closed.
- 
tooltipThe tooltip associated with this tab.- See Also:
 
- 
disableSets 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:
 
- 
disabledIndicates 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:
 
- 
onCloseRequestCalled 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:
 
 
- 
- 
Field Details- 
SELECTION_CHANGED_EVENTCalled when the tab becomes selected or unselected. 
- 
CLOSED_EVENTCalled when a user closes this tab. This is useful for freeing up memory. 
- 
TAB_CLOSE_REQUEST_EVENTCalled 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
 
 
- 
- 
Constructor Details- 
Tabpublic Tab()Creates a tab with no title.
- 
TabCreates a tab with a text title.- Parameters:
- text- The title of the tab.
 
- 
TabCreates a tab with a text title and the specified content node.- Parameters:
- text- The title of the tab.
- content- The content of the tab.
- Since:
- JavaFX 8u40
 
 
- 
- 
Method Details- 
setIdSets 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
 
- 
getIdThe id of this tab.
- 
idPropertyThe id of this tab.- Returns:
- the id property of this tab
- See Also:
 
- 
setStyleA 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
 
- 
getStyleThe CSS style string associated to this tab.
- 
stylePropertyThe CSS style string associated to this tab.- Returns:
- the CSS style string property associated to this tab
- See Also:
 
- 
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
 
- 
selectedPropertyThe currently selected tab.- Returns:
- the selected tab
- See Also:
 
- 
getTabPaneA reference to the TabPane that contains this tab instance. - Returns:
- the TabPane
 
- 
tabPanePropertyThe TabPane that contains this tab.- Returns:
- the TabPane property
- See Also:
 
- 
setTextSets 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
 
- 
getTextThe text shown in the tab.- Returns:
- The text shown in the tab.
 
- 
textPropertyThe text shown in the tab.- Returns:
- the text property
- See Also:
 
- 
setGraphicSets 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
 
- 
getGraphicThe graphic shown in the tab.- Returns:
- The graphic shown in the tab.
 
- 
graphicPropertyThe graphic in the tab.- Returns:
- The graphic in the tab.
- See Also:
 
- 
setContentThe 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
 
- 
getContentThe content associated with the tab. - Returns:
- The content associated with the tab.
 
- 
contentPropertyThe content associated with the tab. - Returns:
- the content property
- See Also:
 
- 
setContextMenuSpecifies the context menu to show when the user right-clicks on the tab. - Parameters:
- value- the context menu
 
- 
getContextMenuThe context menu associated with the tab.- Returns:
- The context menu associated with the tab.
 
- 
contextMenuPropertyThe context menu associated with the tab.- Returns:
- the context menu property
- See Also:
 
- 
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.
 
- 
closablePropertyThe closable state for this tab.- Returns:
- the closable property
- See Also:
 
- 
setOnSelectionChangedDefines a function to be called when a selection changed has occurred on the tab.- Parameters:
- value- the on selection changed event handler
 
- 
getOnSelectionChangedThe event handler that is associated with a selection on the tab.- Returns:
- The event handler that is associated with a tab selection.
 
- 
onSelectionChangedPropertyThe event handler that is associated with a selection on the tab.- Returns:
- the on selection changed event handler property
- See Also:
 
- 
setOnClosedDefines a function to be called when the tab is closed.- Parameters:
- value- the on closed event handler
 
- 
getOnClosedThe 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.
 
- 
onClosedPropertyThe event handler that is associated with the tab when the tab is closed.- Returns:
- the on closed event handler property
- See Also:
 
- 
setTooltipSpecifies the tooltip to show when the user hovers over the tab. - Parameters:
- value- the tool tip value
 
- 
getTooltipThe tooltip associated with this tab.- Returns:
- The tooltip associated with this tab.
 
- 
tooltipPropertyThe tooltip associated with this tab.- Returns:
- the tool tip property
- See Also:
 
- 
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
 
- 
disablePropertySets 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
- Returns:
- the disable property
- Since:
- JavaFX 2.2
- See Also:
 
- 
isDisabledpublic final boolean isDisabled()- Returns:
- true if the TabPane is disabled
- Since:
- JavaFX 2.2
 
- 
disabledPropertyIndicates whether or not thisTabis disabled. ATabwill become disabled ifdisableis set totrueon either itself or if theTabPaneis disabled.- Default value:
- false
- Returns:
- the disabled property
- Since:
- JavaFX 2.2
- See Also:
 
- 
onCloseRequestPropertyCalled when there is an external request to close thisTab. The installed event handler can prevent tab closing by consuming the received event.- Returns:
- the onCloseRequestproperty
- Since:
- JavaFX 8.0
- See Also:
 
- 
getOnCloseRequestGets the value of theonCloseRequestproperty.- 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.
- Returns:
- the value of the onCloseRequestproperty
- Since:
- JavaFX 8.0
- See Also:
 
- 
setOnCloseRequestSets the value of theonCloseRequestproperty.- 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.
- Parameters:
- value- the value for the- onCloseRequestproperty
- Since:
- JavaFX 8.0
- See Also:
 
- 
getPropertiesReturns 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
 
- 
setUserDataConvenience 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
 
- 
getUserDataReturns 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
 
- 
getStyleClassA 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:
 
- 
buildEventDispatchChainDescription copied from interface:EventTargetConstruct 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
 
- 
addEventHandlerpublic final <E extends Event> void addEventHandler(EventType<E> eventType, EventHandler<? super E> eventHandler) Description copied from interface:EventTargetRegisters an event handler for this target.The handler is called when the target receives an Eventof the specified type during the bubbling phase of event delivery.- Specified by:
- addEventHandlerin interface- EventTarget
- Type Parameters:
- E- the event class of the handler
- Parameters:
- eventType- the type of the events received by the handler
- eventHandler- the event handler
 
- 
removeEventHandlerpublic final <E extends Event> void removeEventHandler(EventType<E> eventType, EventHandler<? super E> eventHandler) Description copied from interface:EventTargetUnregisters a previously registered event handler from this target.Since it is possible to register a single EventHandlerinstance for different event types, the caller needs to specify the event type from which the handler should be unregistered.- Specified by:
- removeEventHandlerin interface- EventTarget
- Type Parameters:
- E- the event class of the handler
- Parameters:
- eventType- the event type from which to unregister
- eventHandler- the event handler
 
- 
addEventFilterpublic final <E extends Event> void addEventFilter(EventType<E> eventType, EventHandler<? super E> eventFilter) Description copied from interface:EventTargetRegisters an event filter for this target.The filter is called when the target receives an Eventof the specified type during the capturing phase of event delivery.- Specified by:
- addEventFilterin interface- EventTarget
- Type Parameters:
- E- the event class of the filter
- Parameters:
- eventType- the type of the events received by the filter
- eventFilter- the event filter
 
- 
removeEventFilterpublic final <E extends Event> void removeEventFilter(EventType<E> eventType, EventHandler<? super E> eventFilter) Description copied from interface:EventTargetUnregisters a previously registered event filter from this target.Since it is possible to register a single EventHandlerinstance for different event types, the caller needs to specify the event type from which the filter should be unregistered.- Specified by:
- removeEventFilterin interface- EventTarget
- Type Parameters:
- E- the event class of the filter
- Parameters:
- eventType- the event type from which to unregister
- eventFilter- the event filter
 
- 
getTypeSelectorThe 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
 
- 
getStyleableParentReturn the parent of this Styleable, or null if there is no parent.- Specified by:
- getStyleableParentin interface- Styleable
- Returns:
- getTabPane()
- Since:
- JavaFX 8.0
 
- 
getPseudoClassStatesReturn 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
 
- 
getCssMetaDataThe CssMetaData of this Styleable. This may be returned as an unmodifiable list.- Specified by:
- getCssMetaDatain interface- Styleable
- Returns:
- the CssMetaData
- Since:
- JavaFX 8.0
 
- 
getClassCssMetaDataGets theCssMetaDataassociated with this class, which may include theCssMetaDataof its superclasses.- Returns:
- the CssMetaData
- Since:
- JavaFX 8.0
 
 
-