Class TabPane
- All Implemented Interfaces:
LayoutMeasurable,LayoutMeasurableMixin,HasBackgroundProperty,HasBlendModeProperty,HasBorderProperty,HasClipProperty,HasEffectProperty,HasHeightProperty,HasLayoutXProperty,HasLayoutYProperty,HasManagedProperty,HasMaxHeightProperty,HasMaxWidthProperty,HasMinHeightProperty,HasMinWidthProperty,HasMouseTransparentProperty,HasOnMouseClickedProperty,HasOpacityProperty,HasPaddingProperty,HasParentProperty,HasPrefHeightProperty,HasPrefWidthProperty,HasSnapToPixelProperty,HasVisibleProperty,HasWidthProperty,Styleable,EventTarget,Skinnable,INode,PreferenceResizableNode
A control that allows switching between a group of Tabs. Only one tab
is visible at a time. Tabs are added to the TabPane by using the getTabs().
Tabs in a TabPane can be positioned at any of the four sides by specifying the
Side.
A TabPane has two modes floating or recessed. Applying the styleclass STYLE_CLASS_FLOATING will change the TabPane mode to floating.
The tabs width and height can be set to a specific size by setting the min and max for height and width. TabPane default width will be determined by the largest content width in the TabPane. This is the same for the height. If a different size is desired the width and height of the TabPane can be overridden by setting the min, pref and max size.
When the number of tabs do not fit the TabPane a menu button will appear on the right. The menu button is used to select the tabs that are currently not visible.
Example:
TabPane tabPane = new TabPane();
Tab tab = new Tab();
tab.setText("new tab");
tab.setContent(new Rectangle(200,200, Color.LIGHTSTEELBLUE));
tabPane.getTabs().add(tab);
- Since:
- JavaFX 2.0
- See Also:
-
Property Summary
PropertiesTypePropertyDescriptionfinal BooleanPropertyThe rotatedGraphic state of the tabs in the TabPane.final ObjectProperty<SingleSelectionModel<Tab>>The selection model used for selecting tabs.final ObjectProperty<Side>The position of the tabs in the TabPane.The closing policy for the tabs.final DoublePropertyThe maximum height of the tabs in the TabPane.final DoublePropertyThe maximum width of the tabs in the TabPane.final DoublePropertyThe minimum height of the tab.final DoublePropertyThe minimum width of the tabs in the TabPane.Properties inherited from class javafx.scene.control.Control
contextMenu, skin, tooltipProperties inherited from class javafx.scene.layout.Region
background, border, height, insets, maxHeight, maxWidth, minHeight, minWidth, padding, prefHeight, prefWidth, snapToPixel, widthProperties inherited from class javafx.scene.Parent
needsLayoutProperties inherited from class javafx.scene.Node
blendMode, cacheHint, cache, clip, cursor, disabled, disable, effect, eventDispatcher, focused, focusTraversable, hover, id, layoutBounds, layoutX, layoutY, managed, mouseTransparent, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragged, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onScroll, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, opacity, parent, pressed, rotate, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, visibleProperties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasBlendModeProperty
blendModeProperties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasClipProperty
clipProperties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasEffectProperty
effectProperties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasLayoutXProperty
layoutXProperties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasLayoutYProperty
layoutYProperties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasManagedProperty
managedProperties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasMouseTransparentProperty
mouseTransparentProperties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasOnMouseClickedProperty
onMouseClickedProperties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasOpacityProperty
opacityProperties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasParentProperty
parentProperties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasVisibleProperty
visible -
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThis specifies how the TabPane handles tab closing from an end-users perspective. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringTabPane mode will be changed to floating allowing the TabPane to be placed alongside other control.Fields inherited from interface javafx.scene.INode
BASELINE_OFFSET_SAME_AS_HEIGHTFields inherited from interface javafx.scene.layout.PreferenceResizableNode
USE_COMPUTED_SIZE, USE_PREF_SIZE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Skin<?>Create a new instance of the default skin for this control.final SingleSelectionModel<Tab>Gets the model used for tab selection.final SidegetSide()The current position of the tabs in the TabPane.final TabPane.TabClosingPolicyThe closing policy for the tabs.final doubleThe maximum height of the tabs in the TabPane.final doubleThe maximum width of the tabs in the TabPane.final doubleThe minimum height of the tabs in the TabPane.final doubleThe minimum width of the tabs in the TabPane.final ObservableList<Tab>getTabs()The tabs to display in this TabPane.final booleanReturnstrueif the graphic inside a Tab is rotated.final BooleanPropertyThe rotatedGraphic state of the tabs in the TabPane.final ObjectProperty<SingleSelectionModel<Tab>>The selection model used for selecting tabs.final voidsetRotateGraphic(boolean value) Specifies whether the graphic inside a Tab is rotated or not, such that it is always upright, or rotated in the same way as the Tab text is.final voidsetSelectionModel(SingleSelectionModel<Tab> value) Sets the model used for tab selection.final voidThe position to place the tabs in this TabPane.final voidSpecifies how the TabPane handles tab closing from an end-users perspective.final voidsetTabMaxHeight(double value) Sets the value of thetabMaxHeightproperty.final voidsetTabMaxWidth(double value) Sets the value of thetabMaxWidthproperty.final voidsetTabMinHeight(double value) The minimum height of the tabs in the TabPane.final voidsetTabMinWidth(double value) The minimum width of the tabs in the TabPane.final ObjectProperty<Side>The position of the tabs in the TabPane.The closing policy for the tabs.final DoublePropertyThe maximum height of the tabs in the TabPane.final DoublePropertyThe maximum width of the tabs in the TabPane.final DoublePropertyThe minimum height of the tab.final DoublePropertyThe minimum width of the tabs in the TabPane.Methods inherited from class javafx.scene.control.Control
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, getBaselineOffset, getContextMenu, getSkin, getTooltip, layoutChildren, setContextMenu, setSkin, setTooltip, shouldUseLayoutMeasurable, skinProperty, tooltipPropertyMethods inherited from class javafx.scene.layout.Region
backgroundProperty, borderProperty, boundedSize, getInsets, heightProperty, impl_computeGeomBounds, impl_computeLayoutBounds, impl_maxHeight, impl_maxWidth, impl_minHeight, impl_minWidth, impl_prefHeight, impl_prefWidth, insetsProperty, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeightProperty, maxWidthProperty, minHeightProperty, minWidthProperty, paddingProperty, positionInArea, positionInArea, prefHeightProperty, prefWidthProperty, resize, setMaxSize, setMinSize, setPrefSize, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthPropertyMethods inherited from class javafx.scene.Parent
getChildren, getChildrenUnmodifiable, getManagedChildren, isNeedsLayout, layout, needsLayoutProperty, requestLayout, requestParentLayout, setLayoutFlag, setNeedsLayout, setSceneRootMethods inherited from class javafx.scene.Node
addEventFilter, addEventHandler, autosize, blendModeProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, createLayoutMeasurable, cursorProperty, disabledProperty, disableProperty, effectProperty, eventDispatcherProperty, fireEvent, focusedProperty, focusTraversableProperty, getAllNodeTransforms, getBoundsInLocal, getCacheHint, getCursor, getEventDispatcher, getId, getLayoutMeasurable, getNodePeer, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseDragged, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnScroll, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOrCreateAndBindNodePeer, getProperties, getRotate, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleClass, getTransforms, getTranslateX, getTranslateY, getUserData, hasProperties, hoverProperty, idProperty, impl_getLayoutBounds, impl_isTreeVisible, impl_traverse, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isPressed, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToScene, localToScene, localToScreen, localToScreen, localToScreen, localToScreen, managedProperty, mouseTransparentProperty, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDraggedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onNodePeerReady, onPeerSizeChanged, onScrollProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, opacityProperty, parentProperty, parentToLocal, pressedProperty, removeEventFilter, removeEventHandler, requestFocus, requestPeerFocus, rotateProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, setCache, setCacheHint, setCursor, setDisable, setDisabled, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setNodePeer, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseDragged, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnScroll, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setPressed, setRotate, setScaleX, setScaleY, setScaleZ, setScene, setStyle, setTranslateX, setTranslateY, setUserData, snapshot, startDragAndDrop, styleProperty, toBack, toFront, translateXProperty, translateYProperty, visiblePropertyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasBackgroundProperty
getBackground, setBackgroundMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasBlendModeProperty
blendModeProperty, getBlendMode, setBlendModeMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasBorderProperty
getBorder, setBorderMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasClipProperty
clipProperty, getClip, setClipMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasEffectProperty
effectProperty, getEffect, setEffectMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasHeightProperty
getHeight, setHeightMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasLayoutXProperty
getLayoutX, layoutXProperty, setLayoutXMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasLayoutYProperty
getLayoutY, layoutYProperty, setLayoutYMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasManagedProperty
isManaged, managedProperty, setManagedMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasMaxHeightProperty
getMaxHeight, setMaxHeightMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasMaxWidthProperty
getMaxWidth, setMaxWidthMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasMinHeightProperty
getMinHeight, setMinHeightMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasMinWidthProperty
getMinWidth, setMinWidthMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasMouseTransparentProperty
isMouseTransparent, mouseTransparentProperty, setMouseTransparentMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasOnMouseClickedProperty
getOnMouseClicked, onMouseClickedProperty, setOnMouseClickedMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasOpacityProperty
getOpacity, opacityProperty, setOpacityMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasPaddingProperty
getPadding, setPaddingMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasParentProperty
getParent, parentProperty, setParentMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasPrefHeightProperty
getPrefHeight, setPrefHeightMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasPrefWidthProperty
getPrefWidth, setPrefWidthMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasSnapToPixelProperty
isSnapToPixel, setSnapToPixelMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasVisibleProperty
isVisible, setVisible, visiblePropertyMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasWidthProperty
getWidth, setWidthMethods inherited from interface javafx.scene.INode
autosize, getAllNodeTransforms, getContentBias, getNodePeer, getOrCreateAndBindNodePeer, getProperties, getScene, getTransforms, hasProperties, relocate, resizeRelocateMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.emul_coupling.LayoutMeasurableMixin
clearCache, getLayoutBounds, getLayoutMeasurable, maxHeight, maxWidth, minHeight, minWidth, prefHeight, prefWidthMethods inherited from interface javafx.scene.layout.PreferenceResizableNode
isResizable
-
Property Details
-
selectionModel
The selection model used for selecting tabs. -
side
The position of the tabs in the TabPane.- See Also:
-
tabClosingPolicy
The closing policy for the tabs. -
rotateGraphic
The rotatedGraphic state of the tabs in the TabPane. -
tabMinWidth
The minimum width of the tabs in the TabPane. -
tabMaxWidth
The maximum width of the tabs in the TabPane.- See Also:
-
tabMinHeight
The minimum height of the tab. -
tabMaxHeight
The maximum height of the tabs in the TabPane.
- See Also:
-
-
Field Details
-
STYLE_CLASS_FLOATING
TabPane mode will be changed to floating allowing the TabPane to be placed alongside other control.- See Also:
-
-
Constructor Details
-
TabPane
public TabPane()Constructs a new TabPane. -
TabPane
Constructs a new TabPane with the given tabs set to show.- Parameters:
tabs- Thetabsto display inside the TabPane.- Since:
- JavaFX 8u40
-
-
Method Details
-
getTabs
The tabs to display in this TabPane. Changing this ObservableList will immediately result in the TabPane updating to display the new contents of this ObservableList.
If the tabs ObservableList changes, the selected tab will remain the previously selected tab, if it remains within this ObservableList. If the previously selected tab is no longer in the tabs ObservableList, the selected tab will become the first tab in the ObservableList.
-
setSelectionModel
Sets the model used for tab selection. By changing the model you can alter how the tabs are selected and which tabs are first or last.
-
getSelectionModel
Gets the model used for tab selection.
-
selectionModelProperty
The selection model used for selecting tabs.- Returns:
- the
selectionModelproperty - See Also:
-
setSide
The position to place the tabs in this TabPane. Whenever this changes the TabPane will immediately update the location of the tabs to reflect this.
-
getSide
The current position of the tabs in the TabPane. The default position for the tabs is Side.Top.- Returns:
- The current position of the tabs in the TabPane.
-
sideProperty
The position of the tabs in the TabPane.- Returns:
- the
sideproperty - See Also:
-
setTabClosingPolicy
Specifies how the TabPane handles tab closing from an end-users perspective. The options are:
- TabClosingPolicy.UNAVAILABLE: Tabs can not be closed by the user
- TabClosingPolicy.SELECTED_TAB: Only the currently selected tab will have the option to be closed, with a graphic next to the tab text being shown. The graphic will disappear when a tab is no longer selected.
- TabClosingPolicy.ALL_TABS: All tabs will have the option to be closed.
Refer to the
The default closing policy is TabClosingPolicy.SELECTED_TABTabPane.TabClosingPolicyenumeration for further details. -
getTabClosingPolicy
The closing policy for the tabs.- Returns:
- The closing policy for the tabs.
-
tabClosingPolicyProperty
The closing policy for the tabs.- Returns:
- the
tabClosingPolicyproperty - See Also:
-
setRotateGraphic
public final void setRotateGraphic(boolean value) Specifies whether the graphic inside a Tab is rotated or not, such that it is always upright, or rotated in the same way as the Tab text is.
By default rotateGraphic is set to false, to represent the fact that the graphic isn't rotated, resulting in it always appearing upright. If rotateGraphic is set to
true, the graphic will rotate such that it rotates with the tab text. -
isRotateGraphic
public final boolean isRotateGraphic()Returnstrueif the graphic inside a Tab is rotated. The default isfalse- Returns:
- the rotatedGraphic state.
-
rotateGraphicProperty
The rotatedGraphic state of the tabs in the TabPane.- Returns:
- the
rotateGraphicproperty - See Also:
-
setTabMinWidth
public final void setTabMinWidth(double value) The minimum width of the tabs in the TabPane. This can be used to limit the length of text in tabs to prevent truncation. Setting the min equal to the max will fix the width of the tab. By default the min equals to the max. This value can also be set via CSS using
-fx-tab-min-width -
getTabMinWidth
public final double getTabMinWidth()The minimum width of the tabs in the TabPane.- Returns:
- The minimum width of the tabs.
-
tabMinWidthProperty
The minimum width of the tabs in the TabPane.- Returns:
- the
tabMinWidthproperty - See Also:
-
setTabMaxWidth
public final void setTabMaxWidth(double value) Sets the value of thetabMaxWidthproperty.- Property description:
Specifies the maximum width of a tab. This can be used to limit the length of text in tabs. If the tab text is longer than the maximum width the text will be truncated. Setting the max equal to the min will fix the width of the tab. By default the min equals to the max This value can also be set via CSS using
-fx-tab-max-width.- Parameters:
value- the value for thetabMaxWidthproperty- See Also:
-
getTabMaxWidth
public final double getTabMaxWidth()The maximum width of the tabs in the TabPane.- Returns:
- The maximum width of the tabs.
-
tabMaxWidthProperty
The maximum width of the tabs in the TabPane. -
setTabMinHeight
public final void setTabMinHeight(double value) The minimum height of the tabs in the TabPane. This can be used to limit the height in tabs. Setting the min equal to the max will fix the height of the tab. By default the min equals to the max. This value can also be set via CSS using
-fx-tab-min-height -
getTabMinHeight
public final double getTabMinHeight()The minimum height of the tabs in the TabPane.- Returns:
- The minimum height of the tabs.
-
tabMinHeightProperty
The minimum height of the tab.- Returns:
- the
tabMinHeightproperty - See Also:
-
setTabMaxHeight
public final void setTabMaxHeight(double value) Sets the value of thetabMaxHeightproperty.- Property description:
The maximum height if the tabs in the TabPane. This can be used to limit the height in tabs. Setting the max equal to the min will fix the height of the tab. By default the min equals to the max. This value can also be set via CSS using -fx-tab-max-height
- Parameters:
value- the value for thetabMaxHeightproperty- See Also:
-
getTabMaxHeight
public final double getTabMaxHeight()The maximum height of the tabs in the TabPane.- Returns:
- The maximum height of the tabs.
-
tabMaxHeightProperty
The maximum height of the tabs in the TabPane.
-
createDefaultSkin
Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS-fx-skinor set explicitly in a sub-class withsetSkin(...).- Overrides:
createDefaultSkinin classControl- Returns:
- new instance of default skin for this control. If null then the control will have no skin unless one is provided by css.
-