Class FlatTabbedPaneUI.FlatTabbedPaneScrollLayout

  • All Implemented Interfaces:
    java.awt.LayoutManager
    Enclosing class:
    FlatTabbedPaneUI

    protected class FlatTabbedPaneUI.FlatTabbedPaneScrollLayout
    extends FlatTabbedPaneUI.FlatTabbedPaneLayout
    implements java.awt.LayoutManager
    Layout manager used for scroll tab layout policy.

    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 Detail

      • delegate

        private final javax.swing.plaf.basic.BasicTabbedPaneUI.TabbedPaneLayout delegate
    • Constructor Detail

      • FlatTabbedPaneScrollLayout

        protected FlatTabbedPaneScrollLayout​(javax.swing.plaf.basic.BasicTabbedPaneUI.TabbedPaneLayout delegate)
    • Method Detail

      • calculateLayoutInfo

        public void calculateLayoutInfo()
        Overrides:
        calculateLayoutInfo in class javax.swing.plaf.basic.BasicTabbedPaneUI.TabbedPaneLayout
      • preferredLayoutSize

        public java.awt.Dimension preferredLayoutSize​(java.awt.Container parent)
        Specified by:
        preferredLayoutSize in interface java.awt.LayoutManager
        Overrides:
        preferredLayoutSize in class javax.swing.plaf.basic.BasicTabbedPaneUI.TabbedPaneLayout
      • minimumLayoutSize

        public java.awt.Dimension minimumLayoutSize​(java.awt.Container parent)
        Specified by:
        minimumLayoutSize in interface java.awt.LayoutManager
        Overrides:
        minimumLayoutSize in class javax.swing.plaf.basic.BasicTabbedPaneUI.TabbedPaneLayout
      • addLayoutComponent

        public void addLayoutComponent​(java.lang.String name,
                                       java.awt.Component comp)
        Specified by:
        addLayoutComponent in interface java.awt.LayoutManager
        Overrides:
        addLayoutComponent in class javax.swing.plaf.basic.BasicTabbedPaneUI.TabbedPaneLayout
      • removeLayoutComponent

        public void removeLayoutComponent​(java.awt.Component comp)
        Specified by:
        removeLayoutComponent in interface java.awt.LayoutManager
        Overrides:
        removeLayoutComponent in class javax.swing.plaf.basic.BasicTabbedPaneUI.TabbedPaneLayout