That depends on the layout manager. A FlowLayout acts like a static HTML page or "flowing" from left to right until there is no horizontal space left and then starts a new row. A GridLayout equally distributes the added space to each grid in the layout. A BorderLayout will add new horizontal space to the North, South and Center components and new vertical space to the East, West and Center components. A GridBagLayout depends on a lot of different factors, but gives you greatest control over the position of your components. Michael Morris
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
The layout managers first have to calculate the "preferred size" of each component that goes into the container, so it depends on which layout manager you're using how that is done. Since FlowLayout is probably the one that does the most work in this matter, I'll talk about how FlowLayout handles this. First, it caluclates the preferred size of each and every component, taking into account all of the fonts, initial text values, and other parameters that might affect the size. Next, it adds in the horizontal and vertical spacing that you might have specified, or uses the default. It adds up all of these requirements, and figures out how much space it needs. The pack() method of the container actually does all of these thing. Hope this helps.