Yes. Place the two button panels in a top panel. Use vertical layout for the content pane. Add the top panel and the result panel.
Layout managers sometimes jam components together
in a way that makes the layout look cramped.
Box can help in this situation.
Box object is a container similar to a panel,
but lacking some features.
The default layout manager of
Several previous example programs could be rewritten using
in place of
This would slightly simplify the code since it would rely on the
BoxLayout manager rather than specifically setting it.
Box look like this:
public Box(int axis) where axis is one of: BoxLayout.X_AXIS, BoxLayout.Y_AXIS, (and a few others)
Useful features of class
its methods that create invisible components.
These components correspond to rectangular areas of the screen.
They are used as spacers to separate the visible components.
If you have ever set type you know how useful spacers are in
creating an attractive page.
To create a fixed-sized invisible component use the method:
Box.createRigidArea( new Dimension( int width, int height ) )
The parameter to
which does little more than hold a width and a height.
(Thought Question:) Could
height be arithmetic expressions?