Overview | Schedule | Announcements | Resources | Assignments | Home |
Do |
Practice with arrays. Open the ArrayPractice class. This class has one field, an int array called numbers. The constructor creates the array with length 20 and puts a random number in each cell of the array. There is also a reset() method that can be used to generate another set of cell values for the array. Write and test the following methods:
|
Observe |
Practice with mouse events. Close ArrayPractice and open the Mouse class. Open the class in the editor and observe the mouse event methods. Create an instance of the Mouse class and invoke the start method. As you move the mouse around, observe the events that occur. Click the mouse and observe the three events that occur. Now uncomment the statement "System.out.println(event);" in the mouseMoved method. Create an instance of the Mouse class, invoke the start method and observe the results as you move the mouse. Repeat this step by uncommenting the same statement in the mouseDragged method. Create a Mouse class instance and observe what happens when you drag the mouse. |
Do |
Close the Mouse class and open the Driver class. Create a Driver instance and invoke the start method. Now drag the mouse and observe the results. This class is using an array of circles, myCircle, to represent captured mouse events. Write and test the following methods:
|
Overview | Schedule | Announcements | Resources | Assignments | Home |
DePauw
University , Computer Science
Department , Spring 2005
Maintained by Brian
Howard ( bhoward@depauw.edu
).
Last updated