• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GridBagLayout...!

 
Billy Green
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have some code that i want to display some text field. I am using panels and have textfield and lables positioned using GridBagLayout. When i compile it does not display how i thought it should:

I want it to be like

Name -------------- Surn -------------------

Address ---------------------------------------

Address ---------------------------------------

Country -------------- Post-------------------

but it bunches it all together...please could someone help me get this right?

Thanks,

B

the code is:


 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Billy Green
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks,

Thats now showing as i would like. Would you be kind enough to tell me where i was going wrong? I see that you have commented out alot of constraints and just want to get a better idea of what i need to do next time.

Thanks,

Bil
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The gridwidth constraint specifies how many columns you want a component to span/occupy as stated in the gridwidth section in the discussion section of the GridBagLayout api. Check out the code example in the discussion section. Note how the constraints instance is altered along the way.
 
David Weitzman
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Billy, welcome to JavaRanch. Would you please remove the redundant letters from your name? The ranch naming policy requires normal names so we can keep up the friendly, personal atmosphere. Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic