File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes GridBag Layout  ( Basic fundas) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "GridBag Layout  ( Basic fundas)" Watch "GridBag Layout  ( Basic fundas)" New topic

GridBag Layout ( Basic fundas)

Praveen Kumar
Ranch Hand

Joined: Jul 27, 2000
Posts: 31
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

Praveen Kumar<BR>Mumbai ,India<BR>email:
vidhya Ramachandran

Joined: Sep 15, 2000
Posts: 13

fill specifies how to let the component expand to fill any extra space.
So, I think the answer is 1.

Joined: Sep 14, 2000
Posts: 28
i think 1 and 4 are right..
correct me if I am wrong..

Joined: Sep 07, 2000
Posts: 16
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.

Joined: Sep 14, 2000
Posts: 28

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?
I agree. Here's the link:
subject: GridBag Layout ( Basic fundas)
It's not a secret anymore!