> paint method in java ~ Online tutorial

paint method in java

paint method
  • The Paint is seldom called directly by the programmer because drawing
    graphics is an event-driven process.
  • When an applet executes, the paint method is automatically called (after calls to the JApplet’s init and start methods).
  • For paint to be called again, an event must occur (such as covering and uncovering the applet).
  • Similarly, when any Component is displayed, that Component’s paint method is called.
  • If the programmer needs to call paint, a call is made to the paint class repaint
    method.
  • Method repaint requests a call to the Component class update method as
    soon as possible to clear the Component’s background of any previous drawing, then
    update calls paint directly.
  • The repaint method is frequently called by the programmer to force a paint operation.
  • Method repaint should not be overridden because it performs some system-dependent tasks.
  • The update method is seldom called directly and sometimes overridden. Overriding the update method is useful for “smoothing” animations
  • public void repaint() public void update( Graphics g )
    Method update takes a Graphics object as an argument, which is supplied automatically by the system when update is called.

Buy It Now




Please Give Us Your 1 Minute In Sharing This Post!
Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Powered By: BloggerYard.Com

0 comments: