• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

AWT - Painting question?

 
Ranch Hand
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic