This week's book giveaway is in the JavaScript forum.
We're giving away four copies of JavaScript Promises Essentials and have Rami Sarieddine on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes AWT - Painting question? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "AWT - Painting question?" Watch "AWT - Painting question?" New topic
Author

AWT - Painting question?

Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2579

Are there any questions based on Painting in the real SCJP exam? (on drawString, drawXXX)
Is there a possibility that I could get a question like this in the exam? Has anybody got
a similar question in the exam?
Q48 Marcus Green Mock 1
You have created a simple Frame and overridden the paint method as follows

What will be the result when you attempt to compile and run the program?
1) The string "Dolly" will be displayed at the centre of the frame
2) An error at compilation complaining at the signature of the paint method
3) The lower part of the word Dolly will be seen at the top of the frame, with the top hidden.
4) The string "Dolly" will be shown at the bottom of the frame.
Answer and Explanation -

3) The lower part of the word Dolly will be seen at the top of the form
The Second parameter to the drawstring method indicates where the baseline of the string will be placed. Thus the 3rd parameter of 10 indicates the Y coordinate to be 10 pixels from the top of the Frame. This will result in just the bottom of the string Dolly showing up or possibly only the descending part of the letter y.

TIA,
- Manish
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
The objectives for java.awt are :

- Write code using component,container,and LayoutManager classes of the java.awt package to present a
Graphical User Interface with specified appearance and resize behavior,and distinguish the responsibilities
of layout managers from those of containers
- Write code to implement listener classes and methods,and in listener methods,extract information from
the event to determine the affected component,mouse position,nature,and time of the event
- State the event classname for any specified event listener interface in the java.awt.event package

As you can see on the first bullet, the emphasis is put on Layoutmanagers and how they handle components when containers are resized. That means you should know how a container will look in respect to its contained components when resized. No painting at all.
[ March 19, 2002: Message edited by: Valentin Crettaz ]

SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: AWT - Painting question?