my dog learned polymorphism
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes grid layout 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 "grid layout" Watch "grid layout" New topic

grid layout

Ranch Hand

Joined: Jul 27, 2000
Posts: 45
Could somebody help me with this? It's from Applied reasoning mock exam?
A panel has grid layout with 2 rows and 2 columns. there is a button in each cell and another button is added to the pnale as follows:-
aPanel.addbutton(new button("Bob")). Where will the new button be placed?
A. row1 col3
B. row1 col1
C. row3 col1
D. row2 col3
E. row2 col2
I marked "A" as the number rows remains the same and columns can be increased. But the correct answer was "E". I am confused???
Surya B
Ranch Hand

Joined: May 10, 2000
Posts: 98
When you add an additional component to the grid layout an additional column will be added.So in your question by default you have 2 rows 2 it will be something like
button1 button2
button3 button4
Now when you add an additional button,what happens(???) you will have an addtional column,so now we have 2 rows 3 columns,so now how do you think the buttons will adjust themselves
button1 button2 button3
button4 button5
So whats your answer now
[This message has been edited by Surya B (edited August 29, 2000).]
Ranch Hand

Joined: Jul 27, 2000
Posts: 45
Thanks Surya! That was helpful!
Harry Chawla
Ranch Hand

Joined: Jun 03, 2000
Posts: 97
For GridLayout
No of rows has higher priority and is enforced. If the no of rows is 0, then the no of columns is enforced.
Maybe I'm terse with this one cos' it's mentioned in API and u can try some code to see it in real....

Joined: Aug 28, 2000
Posts: 28
can u give me the link to this applied reasoning mock test??
Ranch Hand

Joined: Jul 27, 2000
Posts: 45
goto to get a list of all the mock exams.
- Antra
I agree. Here's the link:
subject: grid layout
It's not a secret anymore!