You are on page 1of 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