Package com.formdev.flatlaf.ui
Class FlatTabbedPaneUI.FlatTabbedPaneLayout
java.lang.Object
javax.swing.plaf.basic.BasicTabbedPaneUI.TabbedPaneLayout
com.formdev.flatlaf.ui.FlatTabbedPaneUI.FlatTabbedPaneLayout
- All Implemented Interfaces:
LayoutManager
- Direct Known Subclasses:
FlatTabbedPaneUI.FlatTabbedPaneScrollLayout
- Enclosing class:
FlatTabbedPaneUI
Layout manager for wrap tab layout policy (and base class for scroll tab layout policy).
Component hierarchy for wrap tab layout policy:
JTabbedPane
+- 1...n tab content components
+- (optional) BasicTabbedPaneUI.TabContainer (extends JPanel)
| +- 1..n tab components (shown in tab area)
+- (optional) ContainerUIResource (extends JPanel)
| +- leading component
+- (optional) ContainerUIResource (extends JPanel)
+- trailing component
Instead of using super.layoutContainer(Container)
and fixing some
component bounds, this class implements layoutContainer(Container)
and moves/resizes components only once.
This avoids that some components are moved/resized twice, which would unnecessary
repaint and relayout tabbed pane. In some special case this resulted in
"endless" layouting and repainting when using nested tabbed panes (top and
bottom tab placement) and RSyntaxTextArea (with enabled line-wrapping) as tab content.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Dimension
calculateSize
(boolean minimum) protected Dimension
Calculate preferred size of the tab area.(package private) Rectangle
getContentAreaLayoutBounds
(int tabPlacement, Insets tabAreaInsets) Returns bounds for content components.(package private) Rectangle
getTabAreaLayoutBounds
(int tabPlacement, Insets tabAreaInsets) Returns bounds for leading/trailing components and tab area.protected boolean
Check whether all content components are eithernull
or have zero preferred size.(package private) boolean
protected void
layoutChildComponent
(Component c, Rectangle contentAreaBounds) protected void
void
layoutContainer
(Container parent) protected void
(package private) Rectangle
layoutLeftAndRightComponents
(Rectangle tr, int tabAreaAlignment, Insets tabAreaInsets, boolean useTabAreaAlignment, boolean shiftTabs, boolean leftToRight) (package private) void
layoutTabComponents
(Component tabContainer) Layouts custom components in tabs.private void
layoutTabContainer
(Component tabContainer) Layouts container used for custom components in tabs.(package private) Rectangle
layoutTopAndBottomComponents
(Rectangle tr, int tabAreaAlignment, Insets tabAreaInsets, boolean useTabAreaAlignment, boolean shiftTabs) Methods inherited from class javax.swing.plaf.basic.BasicTabbedPaneUI.TabbedPaneLayout
addLayoutComponent, calculateLayoutInfo, calculateTabRects, minimumLayoutSize, normalizeTabRuns, padSelectedTab, padTabRun, preferredLayoutSize, preferredTabAreaHeight, preferredTabAreaWidth, removeLayoutComponent, rotateTabRuns
-
Constructor Details
-
FlatTabbedPaneLayout
protected FlatTabbedPaneLayout()
-
-
Method Details
-
calculateSize
- Overrides:
calculateSize
in classBasicTabbedPaneUI.TabbedPaneLayout
-
isContentEmpty
protected boolean isContentEmpty()Check whether all content components are eithernull
or have zero preferred size.If
true
, assume that the tabbed pane is used without any content and use the size of the tab area (single run) as minimum/preferred size. -
calculateTabAreaSize
Calculate preferred size of the tab area. Used only ifisContentEmpty()
returnstrue
. -
layoutContainer
- Specified by:
layoutContainer
in interfaceLayoutManager
- Overrides:
layoutContainer
in classBasicTabbedPaneUI.TabbedPaneLayout
-
layoutContainerImpl
protected void layoutContainerImpl()- Since:
- 3.3
-
layoutChildComponents
protected void layoutChildComponents()- Since:
- 3.3
-
layoutChildComponent
- Since:
- 3.3
-
isTabContainer
-
layoutTabContainer
Layouts container used for custom components in tabs. -
layoutTabComponents
Layouts custom components in tabs. -
getContentAreaLayoutBounds
Returns bounds for content components. -
getTabAreaLayoutBounds
Returns bounds for leading/trailing components and tab area. Note: Returns bounds for first tabs row only. For multi-rows tabs in wrap mode, the returned bounds does not include full tab area. -
layoutLeftAndRightComponents
-
layoutTopAndBottomComponents
-