private void callDoLayout ( Container container ) { container . doLayout ( ) ; int n = container . getComponentCount ( ) ; for ( int i = 0 ; i < n ; i ++ ) { Component component = container . getComponent ( i ) ; if ( component instanceof Container ) { Container subContainer = ( Container ) component ; callDoLayout ( subContainer ) ; } } }
Recursively call doLayout on the container and all its sub - containers