• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

GridBagLayout...!

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:


 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Billy Green
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic