CIS 35A: Introduction to Java Programming

Home | Green Sheet | Lectures | Assignments | FAQ | Grades

Events

Events
Objectives

Applied

  • Given a class that extends JPanel and includes one or more components that generate events, modify the class so that it implements the appropriate listener interface to respond to those events.
  • Given a class that extends JPanel and includes one or more components that generate events, create a separate class to handle those events, and modify the panel class so that it adds the event class as a listener for each event source.
  • Given a class that extends JPanel and includes one or more components that generate events, add an inner class to handle the events.
  • Given a class that extends JPanel and includes one or more components that generate events, add anonymous inner classes to handle the events.
  • Given a class that extends JPanel and includes one or more components that generate events, add event listeners to handle keyboard and focus events.
  • Write statements that display message dialogs using the JOptionPane class.
  • Given a class that extends JPanel and includes one or more text field components, add data validation to the event listeners for the panel.
  • Given the requirements for an application that uses the event handling and data validation techniques presented in this chapter, write the code to implement the application.

Knowledge

  • Distinguish among an event, an event source, and an event listener.
  • Explain the difference between semantic events and low-level events.
  • List four options for structuring the classes that implement the listener interface for an event.
  • List two options for structuring the classes to handle multiple event sources for a particular event.
  • Explain the difference between an inner class and an anonymous inner class.
  • Describe at least two situations in which you would want to listen to low-level events.
  • Explain the benefit of using adapter classes rather than implementing listener interfaces.
| Handle events | Code low-level events | Validate Swing input data | Application