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(100, 50, Color.LIGHTSTEELBLUE));
tabPane.getTabs().add(tab);
Tab
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| public static enum | TabPane.
Specifies how the |
| public static enum | TabPane.
This enum specifies drag policies for tabs in a TabPane. |
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final PseudoClass | |
| private static final double | |
| private static final double | |
| private static final double | |
| private static final double | |
| private static final PseudoClass | |
| private static final PseudoClass | |
| private BooleanProperty | rotateGraphic
Specifies whether the graphic inside a |
| private ObjectProperty | selectionModel
The selection model used for selecting tabs. |
| private ObjectProperty | side
The position to place the tabs in this |
| public static final String | STYLE_CLASS_FLOATING
TabPane mode will be changed to floating allowing the TabPane to be placed alongside other control. |
| private ObjectProperty | tabClosingPolicy
Specifies how the |
| private ObjectProperty | tabDragPolicy
The drag policy for the tabs. |
| private DoubleProperty | tabMaxHeight
The maximum height of a |
| private DoubleProperty | tabMaxWidth
The maximum width of a |
| private DoubleProperty | tabMinHeight
The minimum height of a |
| private DoubleProperty | tabMinWidth
The minimum width of a |
| private ObservableList | |
| private static final PseudoClass |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected Skin | createDefaultSkin()
Overrides javafx. Create a new instance of the default skin for this control. |
| public static List | Returns: theCssMetaDataHides javafx. Gets the |
| public List | getControlCssMetaData()
Overrides javafx. Gets the unmodifiable list of the control's CSS-styleable properties. |
| public final SingleSelectionModel | |
| public final Side | |
| public final TabPane. | |
| public final TabPane. | |
| public final double | |
| public final double | |
| public final double | |
| public final double | |
| public final ObservableList | |
| public final boolean | |
| public Node | lookup(String selector)
Overrides javafx. Finds this |
| public Set | lookupAll(String selector)
Overrides javafx. Finds all |
| public final BooleanProperty | |
| public final ObjectProperty | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final ObjectProperty | |
| public final ObjectProperty | |
| public final ObjectProperty | |
| public final DoubleProperty | |
| public final DoubleProperty | |
| public final DoubleProperty | |
| public final DoubleProperty |
| BOTTOM_PSEUDOCLASS_STATE | back to summary |
|---|---|
| private static final PseudoClass BOTTOM_PSEUDOCLASS_STATE | |
| DEFAULT_TAB_MAX_HEIGHT | back to summary |
|---|---|
| private static final double DEFAULT_TAB_MAX_HEIGHT | |
| DEFAULT_TAB_MAX_WIDTH | back to summary |
|---|---|
| private static final double DEFAULT_TAB_MAX_WIDTH | |
| DEFAULT_TAB_MIN_HEIGHT | back to summary |
|---|---|
| private static final double DEFAULT_TAB_MIN_HEIGHT | |
| DEFAULT_TAB_MIN_WIDTH | back to summary |
|---|---|
| private static final double DEFAULT_TAB_MIN_WIDTH | |
| LEFT_PSEUDOCLASS_STATE | back to summary |
|---|---|
| private static final PseudoClass LEFT_PSEUDOCLASS_STATE | |
| RIGHT_PSEUDOCLASS_STATE | back to summary |
|---|---|
| private static final PseudoClass RIGHT_PSEUDOCLASS_STATE | |
| rotateGraphic | back to summary |
|---|---|
| private BooleanProperty rotateGraphic Specifies whether the graphic inside a If the value is
| |
| selectionModel | back to summary |
|---|---|
| private ObjectProperty<SingleSelectionModel<Tab>> selectionModel The selection model used for selecting tabs. Changing the model alters how the tabs are selected and which tabs are first or last. | |
| side | back to summary |
|---|---|
| private ObjectProperty<Side> side The position to place the tabs in this
| |
| STYLE_CLASS_FLOATING | back to summary |
|---|---|
| public static final String STYLE_CLASS_FLOATING TabPane mode will be changed to floating allowing the TabPane to be placed alongside other control. | |
| tabClosingPolicy | back to summary |
|---|---|
| private ObjectProperty<TabPane. Specifies how the Refer to the
| |
| tabDragPolicy | back to summary |
|---|---|
| private ObjectProperty<TabPane. The drag policy for the tabs. It specifies if tabs can be reordered or not.
| |
| tabMaxHeight | back to summary |
|---|---|
| private DoubleProperty tabMaxHeight The maximum height of a This value can also be set via CSS using
| |
| tabMaxWidth | back to summary |
|---|---|
| private DoubleProperty tabMaxWidth The maximum width of a This value can also be set via CSS using
| |
| tabMinHeight | back to summary |
|---|---|
| private DoubleProperty tabMinHeight The minimum height of a This value can also be set via CSS using
| |
| tabMinWidth | back to summary |
|---|---|
| private DoubleProperty tabMinWidth The minimum width of a This value can also be set via CSS using
| |
| tabs | back to summary |
|---|---|
| private ObservableList<Tab> tabs | |
| TOP_PSEUDOCLASS_STATE | back to summary |
|---|---|
| private static final PseudoClass TOP_PSEUDOCLASS_STATE | |
| TabPane | back to summary |
|---|---|
| public TabPane() Constructs a new TabPane. | |
| TabPane | back to summary |
|---|---|
| public TabPane(Tab... tabs) Constructs a new TabPane with the given tabs set to show. | |
| createDefaultSkin | back to summary |
|---|---|
| protected Skin Overrides javafx. Doc from javafx. 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
| |
| getClassCssMetaData | back to summary |
|---|---|
| public static List Hides javafx. Gets the
| |
| getControlCssMetaData | back to summary |
|---|---|
| public List Overrides javafx. Doc from javafx. Gets the unmodifiable list of the control's CSS-styleable properties.
| |
| getSelectionModel | back to summary |
|---|---|
| public final SingleSelectionModel | |
| getSide | back to summary |
|---|---|
| public final Side getSide() | |
| getTabClosingPolicy | back to summary |
|---|---|
| public final TabPane. | |
| getTabDragPolicy | back to summary |
|---|---|
| public final TabPane. | |
| getTabMaxHeight | back to summary |
|---|---|
| public final double getTabMaxHeight() | |
| getTabMaxWidth | back to summary |
|---|---|
| public final double getTabMaxWidth() | |
| getTabMinHeight | back to summary |
|---|---|
| public final double getTabMinHeight() | |
| getTabMinWidth | back to summary |
|---|---|
| public final double getTabMinWidth() | |
| getTabs | back to summary |
|---|---|
| public final ObservableList 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.
| |
| isRotateGraphic | back to summary |
|---|---|
| public final boolean isRotateGraphic() | |
| lookup | back to summary |
|---|---|
| public Node lookup(String selector) Overrides javafx. Doc from javafx. Finds this If the lookup selector does not specify a pseudo class, the lookup will ignore pseudo class states; it will return the first matching node whether or not it contains pseudo classes.
For example, if a Node is given the id of "myId", then the lookup method can
be used to find this node as follows:
For example, if two nodes, NodeA and NodeB, have the same style class "myStyle" and NodeA has
a pseudo state "myPseudo", then to find NodeA, the lookup method can be used as follows:
| |
| lookupAll | back to summary |
|---|---|
| public Set Overrides javafx. Doc from javafx. Finds all If the lookupAll selector does not specify a pseudo class, the lookupAll will ignore pseudo class states; it will return all matching nodes whether or not the nodes contain pseudo classes.
For example, if there are multiple nodes with same style class "myStyle", then the lookupAll method can
be used to find all these nodes as follows:
For example, if multiple nodes have same style class "myStyle" and few nodes have
a pseudo state "myPseudo", then to find all nodes with "myPseudo" state, the lookupAll method can be used as follows:
| |
| rotateGraphicProperty | back to summary |
|---|---|
| public final BooleanProperty rotateGraphicProperty() | |
| selectionModelProperty | back to summary |
|---|---|
| public final ObjectProperty | |
| setRotateGraphic | back to summary |
|---|---|
| public final void setRotateGraphic(boolean value) | |
| setSelectionModel | back to summary |
|---|---|
| public final void setSelectionModel(SingleSelectionModel<Tab> value) | |
| setSide | back to summary |
|---|---|
| public final void setSide(Side value) | |
| setTabClosingPolicy | back to summary |
|---|---|
| public final void setTabClosingPolicy(TabPane. | |
| setTabDragPolicy | back to summary |
|---|---|
| public final void setTabDragPolicy(TabPane. | |
| setTabMaxHeight | back to summary |
|---|---|
| public final void setTabMaxHeight(double value) | |
| setTabMaxWidth | back to summary |
|---|---|
| public final void setTabMaxWidth(double value) | |
| setTabMinHeight | back to summary |
|---|---|
| public final void setTabMinHeight(double value) | |
| setTabMinWidth | back to summary |
|---|---|
| public final void setTabMinWidth(double value) | |
| sideProperty | back to summary |
|---|---|
| public final ObjectProperty | |
| tabClosingPolicyProperty | back to summary |
|---|---|
| public final ObjectProperty | |
| tabDragPolicyProperty | back to summary |
|---|---|
| public final ObjectProperty | |
| tabMaxHeightProperty | back to summary |
|---|---|
| public final DoubleProperty tabMaxHeightProperty() | |
| tabMaxWidthProperty | back to summary |
|---|---|
| public final DoubleProperty tabMaxWidthProperty() | |
| tabMinHeightProperty | back to summary |
|---|---|
| public final DoubleProperty tabMinHeightProperty() | |
| tabMinWidthProperty | back to summary |
|---|---|
| public final DoubleProperty tabMinWidthProperty() | |
| Modifier and Type | Field and Description |
|---|---|
| private static final List | |
| private static final CssMetaData | |
| private static final CssMetaData | |
| private static final CssMetaData | |
| private static final CssMetaData |
| Access | Constructor and Description |
|---|---|
| private |
| STYLEABLES | back to summary |
|---|---|
| private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES | |
| TAB_MAX_HEIGHT | back to summary |
|---|---|
| private static final CssMetaData<TabPane, Number> TAB_MAX_HEIGHT | |
| TAB_MAX_WIDTH | back to summary |
|---|---|
| private static final CssMetaData<TabPane, Number> TAB_MAX_WIDTH | |
| TAB_MIN_HEIGHT | back to summary |
|---|---|
| private static final CssMetaData<TabPane, Number> TAB_MIN_HEIGHT | |
| TAB_MIN_WIDTH | back to summary |
|---|---|
| private static final CssMetaData<TabPane, Number> TAB_MIN_WIDTH | |
| StyleableProperties | back to summary |
|---|---|
| private StyleableProperties() | |
TabPane handles tab closing from an end-user's
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.
| Modifier and Type | Field and Description |
|---|---|
| public static final TabPane. | ALL_TABS
All tabs will have the option to be closed. |
| public static final TabPane. | SELECTED_TAB
Only the currently selected tab will have the option to be closed, with a graphic next to the tab text being shown. |
| public static final TabPane. | UNAVAILABLE
Tabs can not be closed by the user. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static TabPane. | |
| public static TabPane. |
| ALL_TABS | back to summary |
|---|---|
| public static final TabPane. All tabs will have the option to be closed. | |
| SELECTED_TAB | back to summary |
|---|---|
| public static final TabPane. 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. | |
| UNAVAILABLE | back to summary |
|---|---|
| public static final TabPane. Tabs can not be closed by the user. | |
| TabClosingPolicy | back to summary |
|---|---|
| private TabClosingPolicy() | |
| valueOf | back to summary |
|---|---|
| public static TabPane. | |
| values | back to summary |
|---|---|
| public static TabPane. | |
| Modifier and Type | Field and Description |
|---|---|
| public static final TabPane. | FIXED
The tabs remain fixed in their positions and cannot be dragged. |
| public static final TabPane. | REORDER
The tabs can be dragged to reorder them within the same TabPane. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static TabPane. | |
| public static TabPane. |
| FIXED | back to summary |
|---|---|
| public static final TabPane. The tabs remain fixed in their positions and cannot be dragged. | |
| REORDER | back to summary |
|---|---|
| public static final TabPane. The tabs can be dragged to reorder them within the same TabPane. Users can perform the simple mouse press-drag-release gesture on a tab header to drag it to a new position. A tab can not be detached from its parent TabPane. After a tab is reordered, the | |
| TabDragPolicy | back to summary |
|---|---|
| private TabDragPolicy() | |
| valueOf | back to summary |
|---|---|
| public static TabPane. | |
| values | back to summary |
|---|---|
| public static TabPane. | |
| Modifier and Type | Field and Description |
|---|---|
| private ListChangeListener | |
| private final TabPane |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private Tab | |
| protected int | getItemCount()
Implements abstract javafx. Gets the number of items available for the selection model. |
| protected Tab | getModelItem(int index)
Implements abstract javafx. Gets the data model item associated with a specific index. |
| public void | select(int index)
Overrides javafx. Selects the given index. |
| public void | select(Tab tab)
Overrides javafx. Selects the index for the first instance of given object in the underlying data model. |
| itemsContentObserver | back to summary |
|---|---|
| private ListChangeListener<Tab> itemsContentObserver | |
| tabPane | back to summary |
|---|---|
| private final TabPane tabPane | |
| TabPaneSelectionModel | back to summary |
|---|---|
| public TabPaneSelectionModel(final TabPane t) | |
| findNearestAvailableTab | back to summary |
|---|---|
| private Tab findNearestAvailableTab(int tabIndex, boolean doSelect) | |
| getItemCount | back to summary |
|---|---|
| protected int getItemCount() Implements abstract javafx. Doc from javafx. Gets the number of items available for the selection model. If the number of items can change dynamically, it is the responsibility of the concrete SingleSelectionModel implementation to ensure that items are selected or unselected as appropriate as the items change.
| |
| getModelItem | back to summary |
|---|---|
| protected Tab getModelItem(int index) Implements abstract javafx. Doc from javafx. Gets the data model item associated with a specific index.
| |
| select | back to summary |
|---|---|
| public void select(int index) Overrides javafx. Doc from javafx. Selects the given index. Since the SingleSelectionModel can only support having a single index selected at a time, this also causes any previously selected index to be unselected.
| |
| select | back to summary |
|---|---|
| public void select(Tab tab) Overrides javafx. Doc from javafx. Selects the index for the first instance of given object in the underlying data model. Since the SingleSelectionModel can only support having a single index selected at a time, this also causes any previously selected index to be unselected.
| |