• 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

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.
 
You’ll find me in my office. I’ll probably be drinking. And reading this tiny ad.
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic