mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 14:00:55 +03:00
TabbedPane: fixed swapped back and forward scroll buttons when using TabbedPane.scrollButtonsPlacement = trailing (regression in FlatLaf 3.3 since commit 97495a6093)
This commit is contained in:
@@ -5,6 +5,8 @@ FlatLaf Change Log
|
||||
|
||||
#### Fixed bugs
|
||||
|
||||
- TabbedPane: Fixed swapped back and forward scroll buttons when using
|
||||
`TabbedPane.scrollButtonsPlacement = trailing` (regression in FlatLaf 3.3).
|
||||
- Extras: `FlatSVGIcon` color filters now support linear gradients. (PR #817)
|
||||
|
||||
|
||||
|
||||
@@ -3851,6 +3851,8 @@ debug*/
|
||||
w -= buttonWidth;
|
||||
moreTabsButtonVisible = true;
|
||||
}
|
||||
|
||||
// layout scroll buttons
|
||||
if( useScrollButtons ) {
|
||||
// the tabViewport view size is set in
|
||||
// BasicTabbedPaneUI.TabbedPaneScrollLayout.calculateTabRects(),
|
||||
@@ -3858,6 +3860,15 @@ debug*/
|
||||
Point viewPosition = tabViewport.getViewPosition();
|
||||
Dimension viewSize = tabViewport.getViewSize();
|
||||
|
||||
// layout forward button on trailing side
|
||||
if( !hideDisabledScrollButtons || viewSize.width - viewPosition.x > w ) {
|
||||
int buttonWidth = forwardButton.getPreferredSize().width;
|
||||
forwardButton.setBounds( leftToRight ? (x + w - buttonWidth) : x, y, buttonWidth, h );
|
||||
x += leftToRight ? 0 : buttonWidth;
|
||||
w -= buttonWidth;
|
||||
forwardButtonVisible = true;
|
||||
}
|
||||
|
||||
// layout backward button
|
||||
if( !hideDisabledScrollButtons || viewPosition.x > 0 ) {
|
||||
int buttonWidth = backwardButton.getPreferredSize().width;
|
||||
@@ -3873,15 +3884,6 @@ debug*/
|
||||
w -= buttonWidth;
|
||||
backwardButtonVisible = true;
|
||||
}
|
||||
|
||||
// layout forward button on trailing side
|
||||
if( !hideDisabledScrollButtons || viewSize.width - viewPosition.x > w ) {
|
||||
int buttonWidth = forwardButton.getPreferredSize().width;
|
||||
forwardButton.setBounds( leftToRight ? (x + w - buttonWidth) : x, y, buttonWidth, h );
|
||||
x += leftToRight ? 0 : buttonWidth;
|
||||
w -= buttonWidth;
|
||||
forwardButtonVisible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3927,6 +3929,8 @@ debug*/
|
||||
h -= buttonHeight;
|
||||
moreTabsButtonVisible = true;
|
||||
}
|
||||
|
||||
// layout scroll buttons
|
||||
if( useScrollButtons ) {
|
||||
// the tabViewport view size is set in
|
||||
// BasicTabbedPaneUI.TabbedPaneScrollLayout.calculateTabRects(),
|
||||
@@ -3934,6 +3938,14 @@ debug*/
|
||||
Point viewPosition = tabViewport.getViewPosition();
|
||||
Dimension viewSize = tabViewport.getViewSize();
|
||||
|
||||
// layout forward button on bottom side
|
||||
if( !hideDisabledScrollButtons || viewSize.height - viewPosition.y > h ) {
|
||||
int buttonHeight = forwardButton.getPreferredSize().height;
|
||||
forwardButton.setBounds( x, y + h - buttonHeight, w, buttonHeight );
|
||||
h -= buttonHeight;
|
||||
forwardButtonVisible = true;
|
||||
}
|
||||
|
||||
// layout backward button
|
||||
if( !hideDisabledScrollButtons || viewPosition.y > 0 ) {
|
||||
int buttonHeight = backwardButton.getPreferredSize().height;
|
||||
@@ -3948,14 +3960,6 @@ debug*/
|
||||
h -= buttonHeight;
|
||||
backwardButtonVisible = true;
|
||||
}
|
||||
|
||||
// layout forward button on bottom side
|
||||
if( !hideDisabledScrollButtons || viewSize.height - viewPosition.y > h ) {
|
||||
int buttonHeight = forwardButton.getPreferredSize().height;
|
||||
forwardButton.setBounds( x, y + h - buttonHeight, w, buttonHeight );
|
||||
h -= buttonHeight;
|
||||
forwardButtonVisible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user