private static void ensureSameWidgetSize ( final DecoratedTabPanel panel ) { if ( ! panel . isAttached ( ) ) { throw new IllegalArgumentException ( "panel not attached: " + panel ) ; } int maxw = 0 ; int maxh = 0 ; for ( final Widget widget : panel ) { final int w = widget . getOffsetWidth ( ) ; final int h = widget . getOffsetHeight ( ) ; if ( w > maxw ) { maxw = w ; } if ( h > maxh ) { maxh = h ; } } if ( maxw == 0 || maxh == 0 ) { throw new IllegalArgumentException ( "maxw=" + maxw + " maxh=" + maxh ) ; } for ( final Widget widget : panel ) { setOffsetWidth ( widget , maxw ) ; setOffsetHeight ( widget , maxh ) ; } }
Ensures all the widgets in the given panel have the same size . Otherwise by default the panel will automatically resize itself to the contents of the currently active panel s widget which is annoying because it makes a number of things move around in the UI .