• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

GridBagLayout

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Choose the correct statement about gridbag layout:

A. The weightx & weighty should have values between 0.0 & 1.0
B. If you specify the fill field is BOTH, there is no meaning to set anchor field
C. If you specify anchor field there is no meaning to set fill field is BOTH
Ans given A,B,C
In API it is specified that weightx,weighty are double values
and default is 0.In some code I have seen them using a value of 100 for weightx.somebody please give actual range of values for weightx/weighty.
Also C appears to be wrong. B is right . How the reverse condition(c) be true??
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The anchor and fill are mutually exclusive, so there is no point in using both.
i.e when fill is used, the entire grid is occupied with the component and you cannot specify which part of the grid should be occupied.
And about the double value you were asking about, if the value is given as 10 or 100 it is in % of the screen the row or column has to occupy which can also be given from 0.0 to 1.0
 
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No. The fields 'fill' and 'anchor' are NOT mutually exclusive. They both have different purposes. 'anchor' is to say where to anchor( N/ NE/ NW /S /SE/SW /E/W ). Fill is used to stretch horizantally or vertially.
The point derived from the above is. When you say fill=both only, anchor doesn't play any role. When you fill ALL the available space then where is the qstn of which directon to place? Wherever you place it is going to occupy all the place right? May be you are mixing up this point. In all other cases except fill is BOTH anchor DOES play a role.
regds
maha anna
[This message has been edited by maha anna (edited April 27, 2000).]
 
It's weird that we cook bacon and bake cookies. Eat this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic