Class FlatTabbedPane
- All Implemented Interfaces:
FlatComponentExtension, FlatStyleableComponent, ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants
JTabbedPane that provides easy access to FlatLaf specific client properties.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enumstatic enumstatic enumstatic enumstatic enumstatic enumstatic enumNested classes/interfaces inherited from class JTabbedPane
JTabbedPane.AccessibleJTabbedPane, JTabbedPane.ModelListenerNested classes/interfaces inherited from class JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
Fields inherited from class JTabbedPane
changeEvent, changeListener, model, SCROLL_TAB_LAYOUT, tabPlacement, WRAP_TAB_LAYOUTFields inherited from class JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields inherited from interface SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a component that will be placed at the leading edge of the tabs area.intReturns the maximum width of a tab.intgetMaximumTabWidth(int tabIndex) Returns the maximum width of the tab at the given tab index.intReturns the minimum width of a tab.intgetMinimumTabWidth(int tabIndex) Returns the minimum width of the tab at the given tab index.Returns the placement of the forward/backward scroll arrow buttons.Returns the display policy for the forward/backward scroll arrow buttons.Returns the horizontal alignment of the tab title and icon.Returns the alignment of the tab area.Returns the insets of the tab area.Returns the callback that is invoked when a tab close button is clicked.getTabCloseCallback(int tabIndex) Returns the callback that is invoked when the tab close button at the given tab index is clicked.Returns the tooltip text used for tab close buttons.getTabCloseToolTipText(int tabIndex) Returns the tooltip text used for tab close button at the given tab index.intReturns the minimum height of a tab.intReturns the tab icon placement (relative to tab title).Returns the insets of a tab.getTabInsets(int tabIndex) Returns the insets of the tab at the given tab index.Returns how the tabs should be rotated.Returns the display policy for the "more tabs" button, which shows a popup menu with the (partly) hidden tabs.Returns type of selected tab.Returns how the tabs should be sized.Returns a component that will be placed at the trailing edge of the tabs area.booleanReturns whether a full border is painted around a tabbed pane.booleanReturns whether the tab area should be hidden if it contains only one tab.booleanReturns whether the separator between tabs area and content area should be shown.booleanReturns whether separators are shown between tabs.isTabClosable(int tabIndex) Returns whether the tab at the given tab index is closable.booleanReturns whether all tabs are closable.voidsetHasFullBorder(boolean hasFullBorder) Specifies whether a full border is painted around a tabbed pane.voidsetHideTabAreaWithOneTab(boolean hideTabAreaWithOneTab) Specifies whether the tab area should be hidden if it contains only one tab.voidsetLeadingComponent(Component leadingComponent) Specifies a component that will be placed at the leading edge of the tabs area.voidsetMaximumTabWidth(int maximumTabWidth) Specifies the maximum width of a tab.voidsetMaximumTabWidth(int tabIndex, int maximumTabWidth) Specifies the maximum width of the tab at the given tab index.voidsetMinimumTabWidth(int minimumTabWidth) Specifies the minimum width of a tab.voidsetMinimumTabWidth(int tabIndex, int minimumTabWidth) Specifies the minimum width of the tab at the given tab index.voidsetScrollButtonsPlacement(FlatTabbedPane.ScrollButtonsPlacement scrollButtonsPlacement) Specifies the placement of the forward/backward scroll arrow buttons.voidsetScrollButtonsPolicy(FlatTabbedPane.ScrollButtonsPolicy scrollButtonsPolicy) Specifies the display policy for the forward/backward scroll arrow buttons.voidsetShowContentSeparators(boolean showContentSeparators) Specifies whether the separator between tabs area and content area should be shown.voidsetShowTabSeparators(boolean showTabSeparators) Specifies whether separators are shown between tabs.voidsetTabAlignment(FlatTabbedPane.TabAlignment tabAlignment) Specifies the horizontal alignment of the tab title and icon.voidsetTabAreaAlignment(FlatTabbedPane.TabAreaAlignment tabAreaAlignment) Specifies the alignment of the tab area.voidsetTabAreaInsets(Insets tabAreaInsets) Specifies the insets of the tab area.voidsetTabClosable(int tabIndex, boolean tabClosable) Specifies whether the tab at the given tab index is closable.voidsetTabCloseCallback(int tabIndex, BiConsumer<JTabbedPane, Integer> tabCloseCallback) Specifies the callback that is invoked when the tab close button at the given tab index is clicked.voidsetTabCloseCallback(BiConsumer<JTabbedPane, Integer> tabCloseCallback) Specifies the callback that is invoked when a tab close button is clicked.voidsetTabCloseToolTipText(int tabIndex, String tabCloseToolTipText) Specifies the tooltip text used for tab close button at the given tab index.voidsetTabCloseToolTipText(String tabCloseToolTipText) Specifies the tooltip text used for tab close buttons.voidsetTabHeight(int tabHeight) Specifies the minimum height of a tab.voidsetTabIconPlacement(int tabIconPlacement) Specifies the tab icon placement (relative to tab title).voidsetTabInsets(int tabIndex, Insets tabInsets) Specifies the insets of the tab at the given tab index.voidsetTabInsets(Insets tabInsets) Specifies the insets of a tab.voidsetTabRotation(FlatTabbedPane.TabRotation tabRotation) Specifies how the tabs should be rotated.voidsetTabsClosable(boolean tabClosable) Specifies whether all tabs are closable.voidsetTabsPopupPolicy(FlatTabbedPane.TabsPopupPolicy tabsPopupPolicy) Specifies the display policy for the "more tabs" button, which shows a popup menu with the (partly) hidden tabs.voidsetTabType(FlatTabbedPane.TabType tabType) Specifies type of selected tab.voidsetTabWidthMode(FlatTabbedPane.TabWidthMode tabWidthMode) Specifies how the tabs should be sized.voidsetTrailingComponent(Component trailingComponent) Specifies a component that will be placed at the trailing edge of the tabs area.Methods inherited from class JTabbedPane
add, add, add, add, add, addChangeListener, addTab, addTab, addTab, createChangeListener, fireStateChanged, getAccessibleContext, getBackgroundAt, getBoundsAt, getChangeListeners, getComponentAt, getDisabledIconAt, getDisplayedMnemonicIndexAt, getForegroundAt, getIconAt, getMnemonicAt, getModel, getSelectedComponent, getSelectedIndex, getTabComponentAt, getTabCount, getTabLayoutPolicy, getTabPlacement, getTabRunCount, getTitleAt, getToolTipText, getToolTipTextAt, getUI, getUIClassID, indexAtLocation, indexOfComponent, indexOfTab, indexOfTab, indexOfTabComponent, insertTab, isEnabledAt, paramString, remove, remove, removeAll, removeChangeListener, removeTabAt, setBackgroundAt, setComponentAt, setDisabledIconAt, setDisplayedMnemonicIndexAt, setEnabledAt, setForegroundAt, setIconAt, setMnemonicAt, setModel, setSelectedComponent, setSelectedIndex, setTabComponentAt, setTabLayoutPolicy, setTabPlacement, setTitleAt, setToolTipTextAt, setUI, updateUIMethods inherited from class JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods inherited from class Container
addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface FlatComponentExtension
getClientProperty, getClientPropertyBoolean, getClientPropertyBoolean, getClientPropertyColor, getClientPropertyEnumString, getClientPropertyInsets, getClientPropertyInt, getClientPropertyInt, putClientProperty, putClientPropertyBoolean, putClientPropertyEnumStringMethods inherited from interface FlatStyleableComponent
getClientProperty, getStyle, getStyleClass, getStyleMap, putClientProperty, setStyle, setStyleClass, setStyleMap
-
Constructor Details
-
FlatTabbedPane
public FlatTabbedPane()
-
-
Method Details
-
isShowTabSeparators
public boolean isShowTabSeparators()Returns whether separators are shown between tabs. -
setShowTabSeparators
public void setShowTabSeparators(boolean showTabSeparators) Specifies whether separators are shown between tabs. -
isShowContentSeparators
public boolean isShowContentSeparators()Returns whether the separator between tabs area and content area should be shown. -
setShowContentSeparators
public void setShowContentSeparators(boolean showContentSeparators) Specifies whether the separator between tabs area and content area should be shown. -
isHasFullBorder
public boolean isHasFullBorder()Returns whether a full border is painted around a tabbed pane. -
setHasFullBorder
public void setHasFullBorder(boolean hasFullBorder) Specifies whether a full border is painted around a tabbed pane. -
isHideTabAreaWithOneTab
public boolean isHideTabAreaWithOneTab()Returns whether the tab area should be hidden if it contains only one tab. -
setHideTabAreaWithOneTab
public void setHideTabAreaWithOneTab(boolean hideTabAreaWithOneTab) Specifies whether the tab area should be hidden if it contains only one tab. -
getMinimumTabWidth
public int getMinimumTabWidth()Returns the minimum width of a tab. -
setMinimumTabWidth
public void setMinimumTabWidth(int minimumTabWidth) Specifies the minimum width of a tab. -
getMinimumTabWidth
public int getMinimumTabWidth(int tabIndex) Returns the minimum width of the tab at the given tab index. -
setMinimumTabWidth
public void setMinimumTabWidth(int tabIndex, int minimumTabWidth) Specifies the minimum width of the tab at the given tab index. -
getMaximumTabWidth
public int getMaximumTabWidth()Returns the maximum width of a tab. -
setMaximumTabWidth
public void setMaximumTabWidth(int maximumTabWidth) Specifies the maximum width of a tab.Applied only if tab does not have a custom tab component (see
JTabbedPane.setTabComponentAt(int, java.awt.Component)). -
getMaximumTabWidth
public int getMaximumTabWidth(int tabIndex) Returns the maximum width of the tab at the given tab index. -
setMaximumTabWidth
public void setMaximumTabWidth(int tabIndex, int maximumTabWidth) Specifies the maximum width of the tab at the given tab index.Applied only if tab does not have a custom tab component (see
JTabbedPane.setTabComponentAt(int, java.awt.Component)). -
getTabHeight
public int getTabHeight()Returns the minimum height of a tab. -
setTabHeight
public void setTabHeight(int tabHeight) Specifies the minimum height of a tab.- See Also:
-
getTabInsets
Returns the insets of a tab. -
setTabInsets
-
getTabInsets
Returns the insets of the tab at the given tab index. -
setTabInsets
Specifies the insets of the tab at the given tab index.- See Also:
-
getTabAreaInsets
Returns the insets of the tab area. -
setTabAreaInsets
Specifies the insets of the tab area. -
isTabsClosable
public boolean isTabsClosable()Returns whether all tabs are closable. -
setTabsClosable
public void setTabsClosable(boolean tabClosable) Specifies whether all tabs are closable. If set totrue, all tabs in that tabbed pane are closable. To make individual tabs closable, usesetTabClosable(int, boolean).Note that you have to specify a callback (see
setTabCloseCallback(BiConsumer)) that is invoked when the user clicks a tab close button. The callback is responsible for closing the tab. -
isTabClosable
Returns whether the tab at the given tab index is closable. -
setTabClosable
public void setTabClosable(int tabIndex, boolean tabClosable) Specifies whether the tab at the given tab index is closable. To make all tabs closable, usesetTabsClosable(boolean).Note that you have to specify a callback (see
setTabCloseCallback(BiConsumer)) that is invoked when the user clicks a tab close button. The callback is responsible for closing the tab. -
getTabCloseToolTipText
Returns the tooltip text used for tab close buttons. -
setTabCloseToolTipText
Specifies the tooltip text used for tab close buttons. -
getTabCloseToolTipText
Returns the tooltip text used for tab close button at the given tab index. -
setTabCloseToolTipText
Specifies the tooltip text used for tab close button at the given tab index. -
getTabCloseCallback
Returns the callback that is invoked when a tab close button is clicked. The callback is responsible for closing the tab. -
setTabCloseCallback
Specifies the callback that is invoked when a tab close button is clicked. The callback is responsible for closing the tab.Use a
BiConsumer<javax.swing.JTabbedPane, Integer> that receives the tabbed pane and the tab index as parameters:
If you need to check whether a modifier key (e.g. Alt or Shift) was pressed while the user clicked the tab close button, usemyTabbedPane.setTabCloseCallback( (tabbedPane, tabIndex) -> { // close tab here } );EventQueue.getCurrentEvent()to get current event, check whether it is aMouseEventand invoke its methods. E.g.AWTEvent e = EventQueue.getCurrentEvent(); boolean shift = (e instanceof MouseEvent) ? ((MouseEvent)e).isShiftDown() : false; -
getTabCloseCallback
Returns the callback that is invoked when the tab close button at the given tab index is clicked. The callback is responsible for closing the tab. -
setTabCloseCallback
Specifies the callback that is invoked when the tab close button at the given tab index is clicked. The callback is responsible for closing the tab.- See Also:
-
getTabType
-
setTabType
-
getTabsPopupPolicy
Returns the display policy for the "more tabs" button, which shows a popup menu with the (partly) hidden tabs. -
setTabsPopupPolicy
Specifies the display policy for the "more tabs" button, which shows a popup menu with the (partly) hidden tabs. -
getScrollButtonsPolicy
Returns the display policy for the forward/backward scroll arrow buttons. -
setScrollButtonsPolicy
Specifies the display policy for the forward/backward scroll arrow buttons. -
getScrollButtonsPlacement
Returns the placement of the forward/backward scroll arrow buttons. -
setScrollButtonsPlacement
Specifies the placement of the forward/backward scroll arrow buttons. -
getTabAreaAlignment
Returns the alignment of the tab area. -
setTabAreaAlignment
Specifies the alignment of the tab area. -
getTabAlignment
Returns the horizontal alignment of the tab title and icon. -
setTabAlignment
Specifies the horizontal alignment of the tab title and icon. -
getTabWidthMode
Returns how the tabs should be sized. -
setTabWidthMode
Specifies how the tabs should be sized. -
getTabRotation
Returns how the tabs should be rotated.- Since:
- 3.3
-
setTabRotation
Specifies how the tabs should be rotated.- Since:
- 3.3
-
getTabIconPlacement
public int getTabIconPlacement()Returns the tab icon placement (relative to tab title). -
setTabIconPlacement
public void setTabIconPlacement(int tabIconPlacement) Specifies the tab icon placement (relative to tab title).Allowed Values are:
-
getLeadingComponent
Returns a component that will be placed at the leading edge of the tabs area. -
setLeadingComponent
Specifies a component that will be placed at the leading edge of the tabs area.For top and bottom tab placement, the layed out component size will be the preferred component width and the tab area height.
For left and right tab placement, the layed out component size will be the tab area width and the preferred component height. -
getTrailingComponent
Returns a component that will be placed at the trailing edge of the tabs area. -
setTrailingComponent
Specifies a component that will be placed at the trailing edge of the tabs area.For top and bottom tab placement, the layed out component size will be the available horizontal space (minimum is preferred component width) and the tab area height.
For left and right tab placement, the layed out component size will be the tab area width and the available vertical space (minimum is preferred component height).
-