• 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
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

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.
 
You would be much easier to understand if you took that bucket off of your head. And that goes for the tiny ad too!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic