Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GridBag Layout ( Basic fundas)

 
Praveen Kumar
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am posting this question based on many similar questions asked in different mock tests.
Which of the following is True about GridBagLayout:
1. If a component has been given Fill BOTH is it true that component
resizes when container resizes.
2. The number of rows and columns are fixed while loading components.
3. The no. of rows and columns are fixed while loading layout itself.
4. If component has a non zero weighty then component grows in height
as the container is resized
 
vidhya Ramachandran
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

fill specifies how to let the component expand to fill any extra space.
So, I think the answer is 1.
 
ramani2020
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think 1 and 4 are right..
correct me if I am wrong..
Ramani.
 
SathishVJ
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not very sure abt this but aren't 1, 2 and 4 right?
1 is definitely right.
4 also is right.
Isn't 2 also right? When the component is loaded the no. of rows and columns are decided by the gridwidth and gridheight variables in the GridBagConstraints instance.
 
ramani2020
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Satish,The gridwidth and gridhieght parameters indicate the number of cells allotted to the component horizontally and vertically .I dont think they decide the number of rows and columns.
could somebody come up with the correct answer,please?
thanks,
Ramani.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic