Its coz of the calling-order of methods pack() and setSize(). Here's wot API-doc says about pack() :
...Causes this Window to be sized to fit the preferred size and layouts of its subcomponents. If the window and/or its owner are not yet displayable, both are made displayable before calculating the preferred size. The Window will be validated after the preferredSize is calculated....
So of course ,da later call to pack() rules over size set by setSize() yes , order give by Jose seems correct and shld solve ur prob . Wish u good luck for ur exam
------------------ Gagan (/^_^\) SCJP2 Die-hard JavaMonk -- little Java a day , keeps u going .
Gagan (/^_^\) SCJP2 SCWCD IBM486 <br />Die-hard JavaMonk -- little Java a day, keeps you going.<br /><a href="http://www.objectfirst.com/blog" target="_blank" rel="nofollow">My Blog</a>