File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes which layout manager Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "which layout manager" Watch "which layout manager" New topic

which layout manager

srilatha malip

Joined: Feb 08, 2001
Posts: 21
Hi All,
I 've 4 comboboxes and 4 labels for these comboboxes , one textfield, two buttons. I am planning to add all these to a Jpanel, and I'll add Jpanel to a JFrame. I'll set the layout manager of frame to a border layout.
What layout will be appropriate for the panel. I don't think flow layout will do, since it will get disturbed with resizing, even the same problem with absolute positioning. All suggestions will be appreciated.
Thanks in advance,
Arunagiri, Shanmugham
Ranch Hand

Joined: Jan 23, 2001
Posts: 46
U can use use Gridlayout for this. Divide ur frame into 5 rows and 1 col . . Put 5 J Panels in each row
Now add 1 label and 1 combobox in each JPanel and 1 textfield and 2 buttons in the last (5th) row.
new GridLayout(5,1);
JPanel p1 = new JPanel();
JPanel p5 = new JPanel();

p1.add(new Label("sds"));
p1.add(new JCombo());
p5.add(new TextField());
p5.add(new Button());
p5.add(new Button());
That's it,

SeE Consulting(P) Ltd
Sun Certified Java Programmer

Sun Certified Programmer for Java2 Platform
I agree. Here's the link:
subject: which layout manager
It's not a secret anymore!