Homework from Java class 2


In the next class, I hope to cover the following stuff:

review - object creation and constructors (forget the syntax stuff - you only learn that by using it.)
new theory stuff - subclassing and inheritance - why bother?
PFE - an IDE I CAN recommend for this class!
practical stuff - applets vs applications (finally some hands on coding!)
the key dirty secret of GUIs - it's all a frame up!


This week's homework to prepare for class:
 


/*********************************************************************************/

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

/**********************************************************************************/


<applet code = pencil width=700 height=450> </applet>


See if you can figure out what it does (Hint: move cursor around in the applet while holding down mouse button.), what major bugs it has and what might be done to fix them in theory...