• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GRIDBAG LAYOUT

 
sheri
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI ALL

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
CAN ANYBODY PLEASE HELP
THANKS IN ADVANCE
SHERIN
 
J. Macha
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would say A,B are correct.
A - I remember reading this somewhere.
B - because setting the fill field to BOTH would cause the component to stretch to fill its display area thus the anchor value would have no effect on the component.
 
raghurajput
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sherin,
The correct ans is B. When u set fill=BOTH, there is no point in specifying anchor as the component will occupy all the space available to it when it is resized.
C is incorrect b'coz the inverse of the statement is true.
Pls correct me if i'm wrong.
Raghu
 
raghurajput
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A is incorrect as weightx and weighty can have any double value. The effect of having weightx=2 and weighty=4 is the same as weightx=100 and weighty=200 as the relative value of weightx and weighty is considered.
 
Aru
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I agree with Raghu, for B & C.
for A....The API just says that the default value of weightx & weighty is zero & should be a positive.
So A is FALSE.
Aruna
 
Sagar Sharma
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
only b is right.
a is wrong because it is not the case always and is not compusary...
c is wrong because eventhough you have set the anchor field you can always fill the cell and that will impact the layout of the component
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic