Java-Repeated Execution of Paint

Repeated Execution of Paint

The paint( ) method is automatically called by the appletviewer or the web browser whenever the applet needs to be refreshed. The paint method is called each time of your applet’s must be redrawn. For example the applet window is minimized and then maximized, paint( ) is also called when the applet begins execution. So, whenever the applet must redraw it output paint( ) is called.

Program

trtetr

Program Source

import java.applet.Applet;
import java.awt.Graphics;

public class Javaapp extends Applet {
    
    int a=0;
    
    public void paint(Graphics g) {
        
        g.drawString("a = "+a, 100, 100);
        a++;
    }
}

Leave a Comment