• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

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

 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here it is with GridBagLayout:
 
Kristof Camelbeke
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the help in this issue !
Kristof
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome.
 
Hey! You're stepping on my hand! Help me tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic