CPSC 170 PreLab 3: GUI Controls and Listeners

  1. Study the section of your book that discusses Checkboxes and Radio Buttons (5.12, p 270-278).
    1. What is the key disctinction between the behavior of Checkboxes and Radio Buttons?

    2. What is distinct about the Listeners assigned to Checkboxes and Radio Buttons?

    3. Why is it necessary to add Radio Buttons to both a ButtonGroup and to the Container?

  2. Study the RubberLines class (and related code) on p419-422
    1. Notice that the LineListener implements both MouseListener and MouseMotionListener. Doesn't that seem to violate multiple inheritance. Explain why not.

    2. Notice that in the paintComponent method, the first line of code is:
      Explain the significance of this line of code. i.e. What does it do and what would be the implications of removing it.

    3. This code will only draw one line at a time. Outline the steps needed to store old lines in an ArrayList and display them when appropriate. (Provide an English description of what code needs to be added and where)