What about more sophisticated user interfaces? The border layout and flow layout managers are very restrictive, and in particular, flow layout has no vertical equivalent. Also, those two layout managers do not pay much attention to the size hints and alignment hints of the components inside them, making it difficult to fine-tune layouts while sticking to the rule that you should mention absolute coordinates as little as possible. For general information about other layout managers, see:
Java Tutorial: Using Layout Managers
Probably the best type of layout to look at next is
box layout.
This is a really good one to learn because you can use it simply for simple
layouts and yet it has enough flexibity and adjustment for sophisticated layouts
and fine tuning. So, you can use it for almost everything!
Perhaps the easiest way of using the box layout is to use the Box class,
which is rather like a JPanel with a box layout.
Here is the row of buttons, re-implemented using the Box class. It is almost identical, except for the default behaviour when you resize the main window: