aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes GridbagLayout help needed (this time with code tags :-) ) 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 "GridbagLayout help needed (this time with code tags :-) )" Watch "GridbagLayout help needed (this time with code tags :-) )" New topic
Author

GridbagLayout help needed (this time with code tags :-) )

Kristof Camelbeke
Ranch Hand

Joined: Nov 28, 2001
Posts: 97
I have the following layout : (T= Textfield)


The problem is I want the last Textfield of 2 positions right next to the first TextField... So I want something like this :

Does anybody know what GridBagConstraints I have to use to achieve this. I just can't seem to place the TextFields with 2 positions after the first TextField.... Thanks for any reply...
Kristof
Bob Dobalina
Ranch Hand

Joined: May 24, 2001
Posts: 53
Just so I'm understanding this correctly, you've got a long and then a short text field on the first line, then a single, long text field on each of the next two lines, followed by long and short text fields on the next lines?
To do this, you'd probably be best off creating nested panels. So, the top line with two text fields would be a single panel which could be added to the top row in the GridBag. Then the second and third lines could be added just by adding the longer text field, then new panels added for the remaining rows.
Either that, or create a table with seven rows and two columns, and set the gridwidth to be two for the second and third rows, and gridwidth to be one for the other rows. I think that would work also...
Hope this helps.
-tim
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
Here it is with GridBagLayout:
Kristof Camelbeke
Ranch Hand

Joined: Nov 28, 2001
Posts: 97
Thanks for the help in this issue !
Kristof
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
You're welcome.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: GridbagLayout help needed (this time with code tags :-) )