Interfaces and event handling

Interfaces

Events

Event handling

To implement event handling for a component:

  1. Create a listener for the type of event by implementing one of the listener interfaces. The listener can be the component itself, another component which contains the component, or a separate listener object (using a defined class for this).
  2. Add the listener to the component using the appropriate method, for example, addMouseListener.
  3. Tell the listener how to respond to different events using the appropriate method(s), for example, actionPerformed, mouseClicked, windowOpening.

Home

Calendar

Coursework & grading

Assignments

Lecture notes

Other resources


IU home

IU CS home

Contact instructor