public void paint(Graphics g) { . . . }



An applet does not have a main() method. It has a collection of methods that the Web browser (or appletViewer) calls at appropriate times.

The paint() method is called by the Web browser to draw the rectangular part of the screen that the applet is responsible for. The Graphics object that is passed to the method represents the rectangular part of the screen given to the applet.

The dimensions of this rectangle are specified in the <applet> tag of the Web page. (More on this, later) Dimensions are measured in pixels. The rectangle may be width pixels across and height pixels in height. A location in the rectangle is given as (X,Y) where both are integers. The (0, 0) location is at the top left.

Think of Graphics as representing a rectangle of graph paper where each small square is a pixel. The columns of pixels are numbered 0 to width-1 starting at the left. The rows of pixels are numbered 0 to height-1 starting at the top.


What is the name of the method (of class Graphics) that draws a line from (x0, y0) to (x1, y1) ?

( int x0, int y0, int x1, int y1)