CPSC 170 PreLab 4

  • Read section 7.9 in the text on Mouse Events and answer the following questions.
    1. What action(s) cause each event below to be generated? Be sure you clearly distinguish how the last is different from the first two.
      • mouse pressed

      • mouse released

      • mouse clicked

    2. In the DotsPanel class in listing 7.19 there is an inner class called DotsListener. In the mousePressed method of this class, what information does the call to event.getPoint() provide? (This method refers to an ArrayList object called pointList. We have not talked about the ArrayList class, but just think of it as representing a list with methods to add items to and iterate over the list.)





    3. Also in the DotsListener inner class:
      1. Why are there empty definitions for mouseClicked, mouseReleased, mouseEntered, and mouseExited? (You may wish to refer to section 6.5 on interfaces.)





      2. What would happen if we took these out?