Core java tutorial for beginners
A tutorial blog which explains different core concepts related to Java along with programming examples
Subscribe to Startertutorials.com's YouTube channel for different tutorial and lecture videos.

Categories: Event Handling. 2 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)

 

How useful was this post?

Click on a star to rate it!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Suryateja Pericherla

Suryateja Pericherla, at present is a Research Scholar (full-time Ph.D.) in the Dept. of Computer Science & Systems Engineering at Andhra University, Visakhapatnam. Previously worked as an Associate Professor in the Dept. of CSE at Vishnu Institute of Technology, India.

He has 11+ years of teaching experience and is an individual researcher whose research interests are Cloud Computing, Internet of Things, Computer Security, Network Security and Blockchain.

He is a member of professional societies like IEEE, ACM, CSI and ISCA. He published several research papers which are indexed by SCIE, WoS, Scopus, Springer and others.

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.

2 Comments

You can follow any responses to this entry through the RSS 2.0 feed.

Great article.

    Thank you , god is kind

Leave a Reply

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