aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes help please? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "help please?" Watch "help please?" New topic
Author

help please?

Brian Snyder
Ranch Hand

Joined: Feb 03, 2001
Posts: 142
I need to have the text box in first row and underneath that two panels that are next to each other. With the code below, I keep getting each panel underneath each other. How do I get two rows so that in first row, I have the text box and the second row, two panels next to each other?
Manfred helped a little with this, but not completely. Thanks for your help....

Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Brian,
If you want a different number of items on each row then you must either use GridBagLayout or make use of more than one GridLayout. For example: place your p2 and p3 into a 1 row, 2 column GridLayout:
Panel p4 = new Panel( new GridLayout(1,0) );
p4.add( p2 );
p4.add( p3 );
Then use top panel having 1 column to place them:
add( p1 ); // First row
add( p4 ); // Second row
If you want to play with borders and insets then you need to go ahead and use GridBagLayout.
Good Luck,
Manfred.
Brian Snyder
Ranch Hand

Joined: Feb 03, 2001
Posts: 142
Thanks Manfred. That was a big help.
Sometimes things seem so obvious after some help. Many thanks.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
i feel u may change ur layout,like gridBagLayout or make the
freme's layout as null.u can use setBounds() method after
setting it to null.
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Jinu,
You should only use the null layout as a last resort! It doesn't provide any functionality for layout changes (i.e., window being resized). As a UI developer, I would be dead set against EVER using null layout. If you don't want to learn the layouts then you shouldn't be using Java to develop apps ... just my opinion.
Regards,
Manfred.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help please?