Difference between GridBagConstraits.fill adn GridBagConstraints.weightx/y
I am haveing trouble laying out a JFrame using the GridBagLayout manager.
I read the sun sit documentation, however I am still haveing problems.
Could someoneplease tell me the difference between GridBagConstraints.fill
and GridBagConstraints.weight. To me they sound like they do the same thing.
Re: Difference between GridBagConstraits.fill adn GridBagConstraints.weightx/y
Harry Tuttle <email@example.com> wrote in message
> I am haveing trouble laying out a JFrame using the GridBagLayout manager.
> I read the sun sit documentation, however I am still haveing problems.
> Could someoneplease tell me the difference between GridBagConstraints.fill
> and GridBagConstraints.weight. To me they sound like they do the same
> Help Please,
> Thanks, Harry
I haven't used a GridBagLayout, but my reading of the documentation is this:
The "weight" fields are arbitrary numbers from 0 to ?, and components with
larger "weight" are more important and will be assigned a larger share of
any extra space that exists.
The "fill" field is a nearly Boolean field that says whether the component
will expand to fill any extra space that has been assigned to it, and if so
whether in the horizontal or vertical direction or both.
So I'd guess that the weights are applied first to divide up empty space
between components, and the fill applies later to see if the components will
expand into the divided-up empty space. But I could be wrong. Best of
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center