Class FlatTabbedPaneUI.FlatTabbedPaneScrollLayout
- All Implemented Interfaces:
LayoutManager
- Enclosing class:
FlatTabbedPaneUI
Component hierarchy for scroll tab layout policy:
JTabbedPane
+- 1...n tab content components
+- BasicTabbedPaneUI.ScrollableTabViewport (extends JViewport)
| +- BasicTabbedPaneUI.ScrollableTabPanel (extends JPanel)
| +- (optional) BasicTabbedPaneUI.TabContainer (extends JPanel)
| +- 1..n tab components (shown in tab area)
+- FlatScrollableTabButton (scroll forward)
+- FlatScrollableTabButton (scroll backward)
+- FlatMoreTabsButton
+- (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.
Although this class delegates nearly all methods to the original layout manager
BasicTabbedPaneUI.TabbedPaneScrollLayout
, which extends
BasicTabbedPaneUI.TabbedPaneLayout
, it is necessary that this class
also extends BasicTabbedPaneUI.TabbedPaneLayout
to avoid a ClassCastException
in BasicTabbedPaneUI
.ensureCurrentLayout().
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addLayoutComponent
(String name, Component comp) void
protected Dimension
Calculate preferred size of the tab area.protected void
layoutChildComponent
(Component c, Rectangle contentAreaBounds) protected void
minimumLayoutSize
(Container parent) preferredLayoutSize
(Container parent) void
Methods inherited from class com.formdev.flatlaf.ui.FlatTabbedPaneUI.FlatTabbedPaneLayout
calculateSize, getContentAreaLayoutBounds, getTabAreaLayoutBounds, isContentEmpty, isTabContainer, layoutChildComponents, layoutContainer, layoutLeftAndRightComponents, layoutTabComponents, layoutTopAndBottomComponents
Methods inherited from class javax.swing.plaf.basic.BasicTabbedPaneUI.TabbedPaneLayout
calculateTabRects, normalizeTabRuns, padSelectedTab, padTabRun, preferredTabAreaHeight, preferredTabAreaWidth, rotateTabRuns
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.awt.LayoutManager
layoutContainer
-
Field Details
-
delegate
-
-
Constructor Details
-
FlatTabbedPaneScrollLayout
-
-
Method Details
-
calculateLayoutInfo
public void calculateLayoutInfo()- Overrides:
calculateLayoutInfo
in classBasicTabbedPaneUI.TabbedPaneLayout
-
calculateTabAreaSize
Description copied from class:FlatTabbedPaneUI.FlatTabbedPaneLayout
Calculate preferred size of the tab area. Used only ifFlatTabbedPaneUI.FlatTabbedPaneLayout.isContentEmpty()
returnstrue
.- Overrides:
calculateTabAreaSize
in classFlatTabbedPaneUI.FlatTabbedPaneLayout
-
preferredLayoutSize
- Specified by:
preferredLayoutSize
in interfaceLayoutManager
- Overrides:
preferredLayoutSize
in classBasicTabbedPaneUI.TabbedPaneLayout
-
minimumLayoutSize
- Specified by:
minimumLayoutSize
in interfaceLayoutManager
- Overrides:
minimumLayoutSize
in classBasicTabbedPaneUI.TabbedPaneLayout
-
addLayoutComponent
- Specified by:
addLayoutComponent
in interfaceLayoutManager
- Overrides:
addLayoutComponent
in classBasicTabbedPaneUI.TabbedPaneLayout
-
removeLayoutComponent
- Specified by:
removeLayoutComponent
in interfaceLayoutManager
- Overrides:
removeLayoutComponent
in classBasicTabbedPaneUI.TabbedPaneLayout
-
layoutContainerImpl
protected void layoutContainerImpl()- Overrides:
layoutContainerImpl
in classFlatTabbedPaneUI.FlatTabbedPaneLayout
- Since:
- 3.3
-
layoutChildComponent
- Overrides:
layoutChildComponent
in classFlatTabbedPaneUI.FlatTabbedPaneLayout
- Since:
- 3.3
-