Event Listener Object

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   go to next page

Answer:

Centered near the top of the content pane.

Event Listener Object

When a GUI program is running, the user generates an event by interacting with a GUI component. Here are some ways to generate an event:

  • Moving the mouse.
  • Clicking the mouse.
  • Clicking on a button.
  • Typing some text into a text area.

For a program to respond to an event there must be an event listener object for it. A event listener object contains a listener method for a specific type of event. A program will ignore events if there is no listener for them.

QUESTION 8:

(Thought question: ) Could an event listener object contain other methods in addition to listener methods?