Action Listener

This example emphasizes an event registration, but forgets event unregistration, therefore possibly leading to a MemoryLeak. This is the typical kind of code that teaches very bad habits to developers.



An ActionListener is a sub-interface of EventListener?

When a user example
  button.addActionListener(this);


ActionListeners in JavaSwing implement the ActionListener interface with an ActionListener.actionPerformed(ActionEvent e) method defined which is called when an event (clicking a button, etc) takes place. They sort-of represent the controller in ModelViewController. -- BrianMcCallister

In what way would you say they differ from the MVC controller?


Listeners are MethodObjects.

They don't have to be.


EditText of this page (last edited November 22, 2013) or FindPage with title or text search