mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-14 07:47:12 -06:00
TabbedPane:
- fixed jittery animated scrolling tabs - support disabling animated scrolling with "ScrollPane.smoothScrolling=false"
This commit is contained in:
@@ -100,6 +100,7 @@ import com.formdev.flatlaf.util.UIScale;
|
|||||||
* @uiDefault TabbedPane.showTabSeparators boolean
|
* @uiDefault TabbedPane.showTabSeparators boolean
|
||||||
* @uiDefault TabbedPane.tabSeparatorsFullHeight boolean
|
* @uiDefault TabbedPane.tabSeparatorsFullHeight boolean
|
||||||
* @uiDefault TabbedPane.hasFullBorder boolean
|
* @uiDefault TabbedPane.hasFullBorder boolean
|
||||||
|
* @uiDefault ScrollPane.smoothScrolling boolean
|
||||||
*
|
*
|
||||||
* @author Karl Tauber
|
* @author Karl Tauber
|
||||||
*/
|
*/
|
||||||
@@ -577,6 +578,16 @@ public class FlatTabbedPaneUI
|
|||||||
return tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT;
|
return tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean isSmoothScrollingEnabled() {
|
||||||
|
if( !Animator.useAnimation() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Note: Getting UI value "ScrollPane.smoothScrolling" here to allow
|
||||||
|
// applications to turn smooth scrolling on or off at any time
|
||||||
|
// (e.g. in application options dialog).
|
||||||
|
return UIManager.getBoolean( "ScrollPane.smoothScrolling" );
|
||||||
|
}
|
||||||
|
|
||||||
//---- class FlatScrollableTabButton --------------------------------------
|
//---- class FlatScrollableTabButton --------------------------------------
|
||||||
|
|
||||||
protected class FlatScrollableTabButton
|
protected class FlatScrollableTabButton
|
||||||
@@ -705,15 +716,14 @@ public class FlatTabbedPaneUI
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// do not use animation if disabled
|
// do not use animation if disabled
|
||||||
if( !Animator.useAnimation() ) {
|
if( !isSmoothScrollingEnabled() ) {
|
||||||
tabViewport.setViewPosition( viewPosition );
|
tabViewport.setViewPosition( viewPosition );
|
||||||
setRolloverTab( lastMouseX, lastMouseY );
|
setRolloverTab( lastMouseX, lastMouseY );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// remember start and target view positions
|
// remember start and target view positions
|
||||||
if( startViewPosition == null )
|
startViewPosition = tabViewport.getViewPosition();
|
||||||
startViewPosition = tabViewport.getViewPosition();
|
|
||||||
targetViewPosition = viewPosition;
|
targetViewPosition = viewPosition;
|
||||||
|
|
||||||
// create animator
|
// create animator
|
||||||
|
|||||||
Reference in New Issue
Block a user