pencilapp.nrx file:
class pencilapp extends Applet
x =int 0 ; y =int 0
method mouseDrag(e=event,i=int,j=int) public returns boolean -- if mouse is moved with button pressed, draw a matching line
getGraphics.drawLine(x,y,i,j)
x = i ; y = j
return 1
method mouseDown(e=event,i=int,j=int) public returns boolean -- when mouse button is pressed, record it's location
x = i ; y = j
return 1
method main(argv=String[]) public static -- if no Applet window is available, build a window frame and put this object in it
p=pencilapp()
f=Frame("pencil test")
f.resize(400,300)
f.add("Center",p)
f.show()