aspose file tools*
The moose likes Mock Exam Errata and the fly likes Bill's Mock Exam(Java2 Exam Prep CD) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Mock Exam Errata
Bookmark "Bill Watch "Bill New topic
Author

Bill's Mock Exam(Java2 Exam Prep CD)

Kavita Ghia
Ranch Hand

Joined: Oct 10, 2000
Posts: 91
Which of the following statements about information you get from MouseEvent events that come to these listeners are correct?
1.The getX() and getY() methods return the position of the event relative to the Panel.
2.The getX() and getY() methods return the position of the event relative to the Frame.
Correct Ans:1
b'coz positions are relative to the component that generates the event.
My Doubt:
Why can't the same logic be applied to the 2. option that is Frame.Afterall even Frame is a component.According to me both the answers are correct.
Please clarify.
Regards,
Kavita.
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Kavita,
I think the answer relates to what source the MouseEvent is coming from. If we have set the Panel to be the MouseEvent listener then 1 would be correct. If we set the Frame to be the MouseEvent listener then 2 would be correct.
The layout here is also important. If we place a Panel into a Frame, the panel will end up in the BorderLayout.CENTER position of the frame which will in effect take up the entire Frame. Therefore, the frame as a mouse listener will never get any events because the Panel is in front of it! This is probably the logic being used by the tester.
Regards,
Manfred.
Kavita Ghia
Ranch Hand

Joined: Oct 10, 2000
Posts: 91
Hi Manfread,
YES.U are right here the layout and on what component the event takes place is important.But how can we make assumptions?How can u assume that Panel is the source of event and not Frame.And again if such questions appear in the exam then what will be the correct answer.
Thanks for your prompt reply.
Regards,
Kavita.
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Kavita,
The exam questions won't be ambiguous and you won't need to assume anything! Don't equate mock exams with the real thing. Most mock exams are just created in spare time. The real exam has been created and developed making sure that all questions are straight forward and correctly worded to avoid any problems.
If you continue down this path you will work yourself into a failing grade without even taking the exam!
If you understand the concepts thoroughly then you will have no problems with the real exam.
Regards,
Manfred.
Kavita Ghia
Ranch Hand

Joined: Oct 10, 2000
Posts: 91
Thanks for the clarifcation.
 
Don't get me started about those stupid light bulbs.
 
subject: Bill's Mock Exam(Java2 Exam Prep CD)