Core java tutorial for beginners
A tutorial blog which explains different core concepts related to Java along with programming examples

April 9, 2016 Categories: Event Handling. No Comments on Event Listener Interfaces

In this article we will learn about various event listener interfaces in Java along with the methods available in each of those listener interfaces.

The event delegation model contains two main components. First are the event sources and second are the listeners. Most of the listener interfaces are available in the java.awt.event package. In Java, there are several event listener interfaces which are listed below:

 

ActionListener 

This interface deals with the action events. Following is the event handling method available in the ActionListener interface:

void actionPerformed(ActionEvent ae)

 

AdjustmentListener

This interface deals with the adjustment event generated by the scroll bar. Following is the event handling method available in the AdjustmentListener interface:

void adjustmentValueChanged(AdjustmentEvent ae)

 

ComponentListener

This interface deals with the component events. Following are the event handling methods available in the ComponentListener interface:

void componentResized(ComponentEvent ce)

void componentMoved(ComponentEvent ce)

void componentShown(ComponentEvent ce)

void componentHidden(ComponentEvent ce)

 

ContainerListener

This interface deals with the events that can be generated on containers. Following are the event handling methods available in the ContainerListener interface:

void componentAdded(ContainerEvent ce)

void componentRemoved(ContainerEvent ce)

 

FocusListener

This interface deals with focus events that can be generated on different components or containers. Following are the event handling methods available in the FocusListener interface:

void focusGained(FocusEvent fe)

void focusLost(FocusEvent fe)

 

ItemListener

This interface deals with the item event. Following is the event handling method available in the ItemListener interface:

void itemStateChanged(ItemEvent ie)

 

KeyListener

This interface deals with the key events. Following are the event handling methods available in the KeyListener interface:

void keyPressed(KeyEvent ke)

void keyReleased(KeyEvent ke)

void keyTyped(KeyEvent ke)

 

MouseListener

This interface deals with five of the mouse events. Following are the event handling methods available in the MouseListener interface:

void mouseClicked(MouseEvent me)

void mousePressed(MouseEvent me)

void mouseReleased(MouseEvent me)

void mouseEntered(MouseEvent me)

void mouseExited(MouseEvent me)

 

MouseMotionListener

This interface deals with two of the mouse events. Following are the event handling methods available in the MouseMotionListener interface:

void mouseMoved(MouseEvent me)

void mouseDragged(MouseEvent me)

 

MouseWheelListener

This interface deals with the mouse wheel event. Following is the event handling method available in the MouseWheelListener interface:

void mouseWheelMoved(MouseWheelEvent mwe)

 

TextListener

This interface deals with the text events. Following is the event handling method available in the TextListener interface:

void textValueChanged(TextEvent te)

 

WindowFocusListener

This interface deals with the window focus events. Following are the event handling methods available in the WindowFocusListener interface:

void windowGainedFocus(WindowEvent we)

void windowLostFocus(WindowEvent we)

 

WindowListener

This interface deals with seven of the window events. Following are the event handling methods available in the WindowListener interface:

void windowActivated(WindowEvent we)

void windowDeactivated(WindowEvent we)

void windowIconified(WindowEvent we)

void windowDeiconified(WindowEvent we)

void windowOpened(WindowEvent we)

void windowClosed(WindowEvent we)

void windowClosing(WindowEvent we)

 

Note: Do you have a question on this article or have a suggestion to make this article better? You can ask or suggest us by filling in the below form. After commenting, your comment will be held for moderation and will be published in 24-48 hrs.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll Up
Thank you for visiting startertutorials.com! If you like this website do share with your friends by clicking on the social icons available on the left hand side.

As the domain name is quite large to remember, use this short domain to visit this site. Short domain: stuts.me