![]() |
Help: Rubberbanding
Help is available for each task, or you can go straight to the solution source code.
Task 2Define paint so that it draws a rectangle at x,y with width, height of w,h.See Graphics for drawing methods. Task 3Define mouseDown so that it sets the x,y of the rectangle to be drawn by paint.The x and y instance variables have been defined for you. Copy the values of the arguments of mouseDown into the instance variables.
Return true from this method as you have handled the event.
The width is the new mouse location minus the mouse down x location. To prevent illegal drawing, set the width or height to 0 if they are found to be negative. Return true from this method as you have handled the event. |
Copyright © 1996-1997 MageLang Institute. All Rights Reserved. |