0% found this document useful (0 votes)
50 views2 pages

Interface Mouselistener: Event Listener (Java - Awt.Event)

The document describes three listener interfaces in Java - MouseListener, ActionListener, and TextListener. MouseListener defines methods like mouseClicked and mousePressed that are called when mouse events occur on a component. ActionListener contains a single actionPerformed method that is called when an action occurs. TextListener's textValueChanged method is invoked when the text value of a component changes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views2 pages

Interface Mouselistener: Event Listener (Java - Awt.Event)

The document describes three listener interfaces in Java - MouseListener, ActionListener, and TextListener. MouseListener defines methods like mouseClicked and mousePressed that are called when mouse events occur on a component. ActionListener contains a single actionPerformed method that is called when an action occurs. TextListener's textValueChanged method is invoked when the text value of a component changes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Event Listener (java.awt.

event )

Interface MouseListener

public interface MouseListener


extends EventListener

The listener interface for receiving "interesting" mouse events (press, release, click, enter, and exit) on a component. (To track
mouse moves and mouse drags, use the MouseMotionListener.)

Method Summary

 void mouseClicked(MouseEvent e)
          Invoked when the mouse has been clicked on a component.

 void mouseEntered(MouseEvent e)
          Invoked when the mouse enters a component.

 void mouseExited(MouseEvent e)
          Invoked when the mouse exits a component.

 void mousePressed(MouseEvent e)
          Invoked when a mouse button has been pressed on a component.

 void mouseReleased(MouseEvent e)
          Invoked when a mouse button has been released on a component.

Method Detail

mouseClicked

public void mouseClicked(MouseEvent e)


Invoked when the mouse has been clicked on a component.

mousePressed

public void mousePressed(MouseEvent e)


Invoked when a mouse button has been pressed on a component.

mouseReleased

public void mouseReleased(MouseEvent e)


Invoked when a mouse button has been released on a component.

mouseEntered

public void mouseEntered(MouseEvent e)


Invoked when the mouse enters a component.

mouseExited

public void mouseExited(MouseEvent e)


Invoked when the mouse exits a component.
Interface ActionListener

public interface ActionListener


extends EventListener

The listener interface for receiving action events. The class that is interested in processing an action event implements this
interface, and the object created with that class is registered with a component, using the component's addActionListener method.
When the action event occurs, that object's actionPerformed method is invoked.

Method Summary

 void actionPerformed(ActionEvent e)
          Invoked when an action occurs.

Method Detail

actionPerformed

public void actionPerformed(ActionEvent e)


Invoked when an action occurs.

Interface TextListener

public interface TextListener


extends EventListener

The listener interface for receiving text events. The class that is interested in processing a text event implements this interface. The
object created with that class is then registered with a component using the component's addTextListener method. When the
component's text changes, the listener object's textValueChanged method is invoked.

Method Summary

 void textValueChanged(TextEvent e)
          Invoked when the value of the text has changed.

Method Detail

textValueChanged

public void textValueChanged(TextEvent e)


Invoked when the value of the text has changed. The code written for this method performs the operations that need to
occur when text changes.

You might also like