mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-14 07:47:12 -06:00
TabbedPane: do not include preferred/minimum size of leading/trailing components in calculating preferred/minimum size of tabbed pane, because the largest tab content determines the size
This commit is contained in:
@@ -1435,7 +1435,7 @@ public class FlatTabbedPaneUI
|
|||||||
//---- class FlatTabbedPaneScrollLayout -----------------------------------
|
//---- class FlatTabbedPaneScrollLayout -----------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Layout manager used if "TabbedPane.hiddenTabsNavigation" is "moreTabsButton".
|
* Layout manager used for scroll tab layout policy.
|
||||||
* <p>
|
* <p>
|
||||||
* Although this class delegates all methods to the original layout manager
|
* Although this class delegates all methods to the original layout manager
|
||||||
* {@link BasicTabbedPaneUI.TabbedPaneScrollLayout}, which extends
|
* {@link BasicTabbedPaneUI.TabbedPaneScrollLayout}, which extends
|
||||||
@@ -1470,36 +1470,6 @@ public class FlatTabbedPaneUI
|
|||||||
delegate.removeLayoutComponent( comp );
|
delegate.removeLayoutComponent( comp );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Dimension preferredLayoutSize( Container parent ) {
|
|
||||||
Dimension size = delegate.preferredLayoutSize( parent );
|
|
||||||
size = addLayoutSize( size, leadingComponent, false );
|
|
||||||
size = addLayoutSize( size, trailingComponent, false );
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Dimension minimumLayoutSize( Container parent ) {
|
|
||||||
Dimension size = delegate.minimumLayoutSize( parent );
|
|
||||||
size = addLayoutSize( size, leadingComponent, true );
|
|
||||||
size = addLayoutSize( size, trailingComponent, true );
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Dimension addLayoutSize( Dimension size, Container c, boolean minimum ) {
|
|
||||||
if( c == null )
|
|
||||||
return size;
|
|
||||||
|
|
||||||
Dimension compSize = minimum ? c.getMinimumSize() : c.getPreferredSize();
|
|
||||||
|
|
||||||
size = (Dimension) size.clone();
|
|
||||||
if( isHorizontalTabPlacement() )
|
|
||||||
size.width += compSize.width;
|
|
||||||
else
|
|
||||||
size.height += compSize.height;
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void layoutContainer( Container parent ) {
|
public void layoutContainer( Container parent ) {
|
||||||
// delegate to original layout manager and let it layout tabs and buttons
|
// delegate to original layout manager and let it layout tabs and buttons
|
||||||
|
|||||||
Reference in New Issue
Block a user