disclaimer, i didn't check any of the syntax, so just use this as a concept -- dont try to copy and paste the code:
Box hBox = Box.createHorizontalBox();
Box vBox = Box.createVerticalBox();
hBox.add(new JTextField("blah"));
hBox.add (new JButton("Click Me"));
vBox.add(new JLabel("enter Blah"));
vBox.add(hBox);
you get something like
-----------
| 1 | <--- vertical box
| |
|-------- |
| | |
| 2 | 3 | <--- horizontal box nested in vBox
-----------
ciderpunx suggestion works too -- I like to do it this way so I don't have to create a lot of other classes. But I have some background in web stuff / using tables for layout so I'm used to thinking in that way -- if you're not, that solution may seem a bit stilted and hard to use to you; in that case, go with the sub-JPanels.
Regards,
Meredith Shaebanyan
|