CSS 1607 - Hints For Homework Program #3

            double distance = Math.sqrt(  (double)  ((X-x1)*(X-x1) + (Y-y1)*(Y-y1))  )

          and then check if distance < 150.

int x1  =  e.getX( );       int y1  =  e.getY( );

Now you need to check if this new point (x1, y1) is inside the circle or not.  If it IS, then set the variable inCircle to true; otherwise, set that variable to false!  With inCircle properly set, your paint( ) method will draw the right thing when it gets called (fillOval( ) versus drawOval( )).

 

 

appletviewer Circle.html

I will use the appletviewer to test your applets (i.e. I won't use a browser like IE or Netscape).