pencil.nrx file:

class pencil extends Applet
 
  x = 0 ; y = 0
  
  method mouseDrag(e=event,i=int,j=int) public returns boolean
	
	getGraphics.drawLine(x,y,i,j)
	x = i ;	y = j
	return 1


pencil2.nrx file: class pencil2 extends Applet x = 0 ; y = 0 method mouseDrag(e=event,i=int,j=int) public returns boolean getGraphics.drawLine(x,y,i,j) x = i ; y = j return 1 method mouseDown(e=event,i=int,j=int) public returns boolean x = i ; y = j return 1

javapencil.java file: import java.awt.*; import java.applet.*; public class javapencil extends Applet { int x = 0; int y = 0; public boolean mouseDrag(Event e, int i, int j) { getGraphics().drawLine(x,y,i,j); x = i; y = j; return true; } public boolean mouseDown(Event e, int i, int j) { x = i; y = j; return true; } }

pencilapp.nrx file: class pencilapp extends Applet x =int 0 ; y =int 0 method mouseDrag(e=event,i=int,j=int) public returns boolean getGraphics.drawLine(x,y,i,j) x = i ; y = j return 1 method mouseDown(e=event,i=int,j=int) public returns boolean x = i ; y = j return 1 method main(argv=String[]) public static p=pencilapp() f=Frame("pencil test") f.resize(400,300) f.add("Center",p) f.show()