Abstract Interface ActionListener in Java

0
219
Spread the love
  • 29
  • 34
  • 56
  • 35
  •  
  •  
  •  
  • 12
  •  
  •  
    166
    Shares

Abstract Interface ActionListener in Java

ActionListener interface defines the method that an object must implement to listen for action events on AWT components. When as ActionEvent occurs, an AWT component notifies it’s registered ActionListener objects by invoking the actionPerformed() methods.

Objects that implement the ActionListener interface can receive ActionEvent objects. Listeners must first register themselves with objects that produce events. When events occur, they are then automatically propagated to all registered listeners.

The structure of the ActionListener interface is given as:

public abstract interface java.awt.event.ActionListener extends java.util.EventListener{
//method
public abstract void actionPerformed(ActionEvent e);
} 

The details of the class structure are given as follows:

public abstract void actionPerformed(ActionEvent e);

public abstract void actionPerformed(ActionEvent e) method notifies the ActionListener that an event occurred.

Parameter
e – The action event that occurred.

Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

Spread the love
  • 29
  • 34
  • 56
  • 35
  •  
  •  
  •  
  • 12
  •  
  •  
    166
    Shares

LEAVE A REPLY

Please enter your comment!
Please enter your name here