Skip to main content

Strange behaviour in Container.getSideGap()

1 reply [Last post]
Joined: 2008-06-13
Points: 0


There is a possible bug the optimization in the following method

public int getSideGap() {
// isScrollableY() in the base method is very expensive since it triggers getScrollDimension before the layout is complete!

if (scrollableY && isScrollVisible()) {
return UIManager.getInstance().getLookAndFeel().getVerticalScrollWidth();
return 0;


In some case (always in a menu with touch commands), the container dont to need to scrollable and the space is reserved to the vertical scrollbar and the vertical scrollbar is not displayed (Normal, there is enough space).

If a replace the test "if (scrollableY && isScrollVisible()) " by "if(isScrollableY()==true)" all is working fine

the best is to create a flag for optimization setable by method in some case

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-11-07
Points: 0

An alternative is to hide the scrollbar, please file an issue on this and I will try to think of a more sensible optimization.