Author Topic:   GridBagLayout
Mani
ranch hand
posted April 26, 2000 10:16 AM             
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??

Sripriya Varadheeshwaran
greenhorn
posted April 26, 2000 10:50 AM             
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

maha anna
bartender
posted April 27, 2000 08:31 AM             
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).]

|