2 questions about layout?

Hi, all

I have 2 questions about component layout and still don't find any answers yet.

1. I have several components in a jpanel which use gridbag layout. Only small potion of jpanel space used, so all components placed in the center of the screen. Can I move all components to the upper left screen? I tried GridBagConstraints.NORTHWEST on each components but won't work.

2. I tried to layout these components. 1 jlabel and textfield in first row, 2 checkbox in the 2nd, 3th rows. Is gridbag layout the only option? I prefer to use gridlayout but can't put 2 components in the 1st row. Is there any better solution?

Thanks,

Vincent Chen

[677 byte] By [VC@TWa] at [2007-10-2 3:12:03]
# 1

[url http://java.sun.com/docs/books/tutorial/uiswing/layout/visual.html]How to Use Layout Managers[/url]

You can use any combination of LayoutManagers you want to get the desired effect.

> Only small potion of jpanel space used, so all components placed in

> the center of the screen. Can I move all components to the upper left screen?

Use pack() to size the frame of dialog according to the components that have been added to the container.

camickra at 2007-7-15 21:39:01 > top of Java-index,Desktop,Core GUI APIs...