java.awt.event
Class MouseAdapter

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.awt.event.MouseAdapter
All Implemented Interfaces:
MouseListener sample code for java.awt.event.MouseListener definition code for java.awt.event.MouseListener , EventListener sample code for java.util.EventListener definition code for java.util.EventListener
Direct Known Subclasses:
BasicComboPopup.InvocationMouseHandler sample code for javax.swing.plaf.basic.BasicComboPopup.InvocationMouseHandler definition code for javax.swing.plaf.basic.BasicComboPopup.InvocationMouseHandler , BasicComboPopup.ListMouseHandler sample code for javax.swing.plaf.basic.BasicComboPopup.ListMouseHandler definition code for javax.swing.plaf.basic.BasicComboPopup.ListMouseHandler , BasicFileChooserUI.DoubleClickListener sample code for javax.swing.plaf.basic.BasicFileChooserUI.DoubleClickListener definition code for javax.swing.plaf.basic.BasicFileChooserUI.DoubleClickListener , BasicScrollBarUI.ArrowButtonListener sample code for javax.swing.plaf.basic.BasicScrollBarUI.ArrowButtonListener definition code for javax.swing.plaf.basic.BasicScrollBarUI.ArrowButtonListener , BasicScrollBarUI.TrackListener sample code for javax.swing.plaf.basic.BasicScrollBarUI.TrackListener definition code for javax.swing.plaf.basic.BasicScrollBarUI.TrackListener , BasicSplitPaneDivider.MouseHandler sample code for javax.swing.plaf.basic.BasicSplitPaneDivider.MouseHandler definition code for javax.swing.plaf.basic.BasicSplitPaneDivider.MouseHandler , BasicTabbedPaneUI.MouseHandler sample code for javax.swing.plaf.basic.BasicTabbedPaneUI.MouseHandler definition code for javax.swing.plaf.basic.BasicTabbedPaneUI.MouseHandler , BasicTreeUI.MouseHandler sample code for javax.swing.plaf.basic.BasicTreeUI.MouseHandler definition code for javax.swing.plaf.basic.BasicTreeUI.MouseHandler , FormView.MouseEventListener sample code for javax.swing.text.html.FormView.MouseEventListener definition code for javax.swing.text.html.FormView.MouseEventListener , HTMLEditorKit.LinkController sample code for javax.swing.text.html.HTMLEditorKit.LinkController definition code for javax.swing.text.html.HTMLEditorKit.LinkController , MetalFileChooserUI.SingleClickListener sample code for javax.swing.plaf.metal.MetalFileChooserUI.SingleClickListener definition code for javax.swing.plaf.metal.MetalFileChooserUI.SingleClickListener , ToolTipManager sample code for javax.swing.ToolTipManager definition code for javax.swing.ToolTipManager

public abstract class MouseAdapter
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements MouseListener sample code for java.awt.event.MouseListener definition code for java.awt.event.MouseListener

An abstract adapter class for receiving mouse events. The methods in this class are empty. This class exists as convenience for creating listener objects.

Mouse events let you track when a mouse is pressed, released, clicked, when it enters a component, and when it exits. (To track mouse moves and mouse drags, use the MouseMotionAdapter.)

Extend this class to create a MouseEvent listener and override the methods for the events of interest. (If you implement the MouseListener interface, you have to define all of the methods in it. This abstract class defines null methods for them all, so you can only have to define methods for events you care about.)

Create a listener object using the extended class and then register it with a component using the component's addMouseListener method. When a mouse button is pressed, released, or clicked (pressed and released), or when the mouse cursor enters or exits the component, the relevant method in the listener object is invoked and the MouseEvent is passed to it.

Since:
1.1
See Also:
MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent , MouseListener sample code for java.awt.event.MouseListener definition code for java.awt.event.MouseListener , Tutorial: Writing a Mouse Listener, Reference: The Java Class Libraries (update file)

Constructor Summary
MouseAdapter sample code for java.awt.event.MouseAdapter.MouseAdapter() definition code for java.awt.event.MouseAdapter.MouseAdapter() ()
           
 
Method Summary
 void mouseClicked sample code for java.awt.event.MouseAdapter.mouseClicked(java.awt.event.MouseEvent) definition code for java.awt.event.MouseAdapter.mouseClicked(java.awt.event.MouseEvent) (MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent  e)
          Invoked when the mouse has been clicked on a component.
 void mouseEntered sample code for java.awt.event.MouseAdapter.mouseEntered(java.awt.event.MouseEvent) definition code for java.awt.event.MouseAdapter.mouseEntered(java.awt.event.MouseEvent) (MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent  e)
          Invoked when the mouse enters a component.
 void mouseExited sample code for java.awt.event.MouseAdapter.mouseExited(java.awt.event.MouseEvent) definition code for java.awt.event.MouseAdapter.mouseExited(java.awt.event.MouseEvent) (MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent  e)
          Invoked when the mouse exits a component.
 void mousePressed sample code for java.awt.event.MouseAdapter.mousePressed(java.awt.event.MouseEvent) definition code for java.awt.event.MouseAdapter.mousePressed(java.awt.event.MouseEvent) (MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent  e)
          Invoked when a mouse button has been pressed on a component.
 void mouseReleased sample code for java.awt.event.MouseAdapter.mouseReleased(java.awt.event.MouseEvent) definition code for java.awt.event.MouseAdapter.mouseReleased(java.awt.event.MouseEvent) (MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent  e)
          Invoked when a mouse button has been released on a component.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

MouseAdapter sample code for java.awt.event.MouseAdapter() definition code for java.awt.event.MouseAdapter()

public MouseAdapter()
Method Detail

mouseClicked sample code for java.awt.event.MouseAdapter.mouseClicked(java.awt.event.MouseEvent) definition code for java.awt.event.MouseAdapter.mouseClicked(java.awt.event.MouseEvent)

public void mouseClicked(MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent  e)
Invoked when the mouse has been clicked on a component.

Specified by:
mouseClicked sample code for java.awt.event.MouseListener.mouseClicked(java.awt.event.MouseEvent) definition code for java.awt.event.MouseListener.mouseClicked(java.awt.event.MouseEvent) in interface MouseListener sample code for java.awt.event.MouseListener definition code for java.awt.event.MouseListener

mousePressed sample code for java.awt.event.MouseAdapter.mousePressed(java.awt.event.MouseEvent) definition code for java.awt.event.MouseAdapter.mousePressed(java.awt.event.MouseEvent)

public void mousePressed(MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent  e)
Invoked when a mouse button has been pressed on a component.

Specified by:
mousePressed sample code for java.awt.event.MouseListener.mousePressed(java.awt.event.MouseEvent) definition code for java.awt.event.MouseListener.mousePressed(java.awt.event.MouseEvent) in interface MouseListener sample code for java.awt.event.MouseListener definition code for java.awt.event.MouseListener

mouseReleased sample code for java.awt.event.MouseAdapter.mouseReleased(java.awt.event.MouseEvent) definition code for java.awt.event.MouseAdapter.mouseReleased(java.awt.event.MouseEvent)

public void mouseReleased(MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent  e)
Invoked when a mouse button has been released on a component.

Specified by:
mouseReleased sample code for java.awt.event.MouseListener.mouseReleased(java.awt.event.MouseEvent) definition code for java.awt.event.MouseListener.mouseReleased(java.awt.event.MouseEvent) in interface MouseListener sample code for java.awt.event.MouseListener definition code for java.awt.event.MouseListener

mouseEntered sample code for java.awt.event.MouseAdapter.mouseEntered(java.awt.event.MouseEvent) definition code for java.awt.event.MouseAdapter.mouseEntered(java.awt.event.MouseEvent)

public void mouseEntered(MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent  e)
Invoked when the mouse enters a component.

Specified by:
mouseEntered sample code for java.awt.event.MouseListener.mouseEntered(java.awt.event.MouseEvent) definition code for java.awt.event.MouseListener.mouseEntered(java.awt.event.MouseEvent) in interface MouseListener sample code for java.awt.event.MouseListener definition code for java.awt.event.MouseListener

mouseExited sample code for java.awt.event.MouseAdapter.mouseExited(java.awt.event.MouseEvent) definition code for java.awt.event.MouseAdapter.mouseExited(java.awt.event.MouseEvent)

public void mouseExited(MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent  e)
Invoked when the mouse exits a component.

Specified by:
mouseExited sample code for java.awt.event.MouseListener.mouseExited(java.awt.event.MouseEvent) definition code for java.awt.event.MouseListener.mouseExited(java.awt.event.MouseEvent) in interface MouseListener sample code for java.awt.event.MouseListener definition code for java.awt.event.MouseListener