aspose file tools*
The moose likes Mock Exam Errata and the fly likes GridBagLayout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Mock Exam Errata
Bookmark "GridBagLayout" Watch "GridBagLayout" New topic
Author

GridBagLayout

Deepali Shanbhag
Greenhorn

Joined: Nov 07, 2000
Posts: 3
Hi...
I was giving JavaCaps mock exam wherein I came across this question. I marked the answer as 3 and 4 but the answer according to the exam is 1,2,3 . Can you just tell me if I am correct or the answer given in the exam is correct.
1. Which statements are true about GridbagLayout?
1. Weightx and weighty should be 0 and 1.0
2. If fill is both anchor does not make sense
3. It divides its territory into array of cells
4. While constructing GridBagLayout, you wont tell how many rows and columns the underlying grid has.
Thank you
Kamakshi Mahadevan
Greenhorn

Joined: Nov 08, 2000
Posts: 18
1. Which statements are true about GridbagLayout?
1. Weightx and weighty should be 0 and 1.0
- NO. you can have values greater than 1.0 & less than 0 for weightx and weighty. the code would compile just fine. But what matters is not the actual value you assign, but the relative values of weightx and weighty.
2. If fill is both, anchor does not make sense.
- YES. 'anchor' is used to specify where to place a component when it is smaller than its display area. But when fill is BOTH, the component occupies its entire display area. So it is meaningless to specify 'anchor'.
3. It divides its territory into array of cells
- YES.for obvious reasons.

4. While constructing GridBagLayout, you won't tell how many rows and columns the underlying grid has.
-NO. At first, this might seem right. The GridBagLayout is a dynamically growing array of cells.There is no constructor to specify the rows & columns explicitly. But using gridx and gridy we can specify the row & column every component should go to. That way we are specifying how many rows & columns the grid finally has.
So I think the correct answers are: 2 and 3.
Regards,
Kamakshi.
[This message has been edited by Kamakshi Mahadevan (edited November 11, 2000).]
Aparna Narayanan
Ranch Hand

Joined: Nov 07, 2000
Posts: 44
Hi Kamakshi,
I guess the answer you gave is also incorrect:
1. Which statements are true about GridbagLayout?
1. Weightx and weighty should be 0 and 1.0
WRONG. Weightx and weighty can be any valid double value
2. If fill is both anchor does not make sense
CORRECT
3. It divides its territory into array of cells
CORRECT
4. While constructing GridBagLayout, you wont tell how many rows and columns the underlying grid has.
CORRECT. The question asked is "While constructing GridBagLayout", which means, in the constructor, you don't specify the number of rows and columns. Hence 4th option is CORRECT.
Any other opinions?
Thanks,
Aparna
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: GridBagLayout