Difference between GridBagConstraits.fill adn GridBagConstraints.weightx/y


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Difference between GridBagConstraits.fill adn GridBagConstraints.weightx/y

  1. #1
    Harry Tuttle Guest

    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.


    Help Please,

    Thanks, Harry


  2. #2
    Paul Clapham Guest

    Re: Difference between GridBagConstraits.fill adn GridBagConstraints.weightx/y


    Harry Tuttle <harrytuttle89@hotmail.com> wrote in message
    news:391c76c6$1@news.devx.com...
    >
    > 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.
    >
    >
    > 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
    luck.




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center