mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-07 06:20:53 +03:00
TabbedPane: fixes
- avoid that tab area "jump" to the right/top when backward button becomes hidden - scroll arrow buttons were not always hidden in right-to-left horizontal layout
This commit is contained in:
@@ -2563,7 +2563,7 @@ public class FlatTabbedPaneUI
|
|||||||
// because methods scrollForward() and scrollBackward() in class
|
// because methods scrollForward() and scrollBackward() in class
|
||||||
// BasicTabbedPaneUI.ScrollableTabSupport do not work for right-to-left
|
// BasicTabbedPaneUI.ScrollableTabSupport do not work for right-to-left
|
||||||
boolean leftToRight = isLeftToRight();
|
boolean leftToRight = isLeftToRight();
|
||||||
if( !leftToRight && !useMoreTabsButton && isHorizontalTabPlacement() ) {
|
if( !leftToRight && isHorizontalTabPlacement() ) {
|
||||||
useMoreTabsButton = true;
|
useMoreTabsButton = true;
|
||||||
useScrollButtons = false;
|
useScrollButtons = false;
|
||||||
}
|
}
|
||||||
@@ -2581,7 +2581,7 @@ public class FlatTabbedPaneUI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !useMoreTabsButton && (backwardButton == null || forwardButton == null) )
|
if( backwardButton == null || forwardButton == null )
|
||||||
return; // should never occur
|
return; // should never occur
|
||||||
|
|
||||||
Rectangle bounds = tabPane.getBounds();
|
Rectangle bounds = tabPane.getBounds();
|
||||||
@@ -2610,6 +2610,13 @@ public class FlatTabbedPaneUI
|
|||||||
|
|
||||||
// layout tab area
|
// layout tab area
|
||||||
if( tabPlacement == TOP || tabPlacement == BOTTOM ) {
|
if( tabPlacement == TOP || tabPlacement == BOTTOM ) {
|
||||||
|
// avoid that tab area "jump" to the right when backward button becomes hidden
|
||||||
|
if( useScrollButtons && hideDisabledScrollButtons ) {
|
||||||
|
Point viewPosition = tabViewport.getViewPosition();
|
||||||
|
if( viewPosition.x <= backwardButton.getPreferredSize().width )
|
||||||
|
tabViewport.setViewPosition( new Point( 0, viewPosition.y ) );
|
||||||
|
}
|
||||||
|
|
||||||
// tab area height (maxTabHeight is zero if tab count is zero)
|
// tab area height (maxTabHeight is zero if tab count is zero)
|
||||||
int tabAreaHeight = (maxTabHeight > 0)
|
int tabAreaHeight = (maxTabHeight > 0)
|
||||||
? maxTabHeight
|
? maxTabHeight
|
||||||
@@ -2726,6 +2733,13 @@ public class FlatTabbedPaneUI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // LEFT and RIGHT tab placement
|
} else { // LEFT and RIGHT tab placement
|
||||||
|
// avoid that tab area "jump" to the top when backward button becomes hidden
|
||||||
|
if( useScrollButtons && hideDisabledScrollButtons ) {
|
||||||
|
Point viewPosition = tabViewport.getViewPosition();
|
||||||
|
if( viewPosition.y <= backwardButton.getPreferredSize().height )
|
||||||
|
tabViewport.setViewPosition( new Point( viewPosition.x, 0 ) );
|
||||||
|
}
|
||||||
|
|
||||||
// tab area width (maxTabWidth is zero if tab count is zero)
|
// tab area width (maxTabWidth is zero if tab count is zero)
|
||||||
int tabAreaWidth = (maxTabWidth > 0)
|
int tabAreaWidth = (maxTabWidth > 0)
|
||||||
? maxTabWidth
|
? maxTabWidth
|
||||||
|
|||||||
Reference in New Issue
Block a user