Win a copy of Spring Boot in Practice this week in the Spring forum!
  • 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

GridBag help

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Finally I'm feeling comfortable with GridBagLayout and the constraints used by GridBagConstraints. However I'm still confused with weightx and weighty. I'm not sure how they work and what good using them. The only visible effect I got is, suppose when using weighty, extra space is entered between two components when the window is enlarged vertically. I'm also confused about the values (0.0 - 1.0) used for these.

Despite its flexibility, I'm unable to do the following using GridBagLayout: I have three buttons. two below the other. I want to make the top one as long as the total length of the bottom two. That is the top button spans two columns.
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using the weight constraints is more subtle and is a key to fluid layouts that resize gracefully. The nominal range is 1 to 1.0 but some prefer to use larger, integer values.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic