|
|
GUI Changes: The AWT Grows Up |
Mouse motion events tell you when the user moves the onscreen cursor using the mouse or a similar input device. For information on tracking other mouse event types such as clicks, see Writing a Mouse Listener.Mouse Motion Event Methods
TheMouseMotionListenerinterface and its corresponding adapter class,
MouseMotionAdapter, contain two methods:
void mouseDragged(MouseEvent)- Notifies the listener ...
void mouseMoved(MouseEvent)- Notifies the listener ...
Examples of Handling Mouse Motion Events
The following applet demonstrates mouse motion events. [describe applet][applet goes here]
Try this:
- Do something...
You can find the applet's code in MouseMotionDemo.java. Here is the applet's mouse motion event handling code:
[code goes here]You can find more examples of mouse motion listeners in the following sections: [LIST GOES HERE]
The
MouseEventClassEach mouse motion event method has a single parameter -- and it's not calledMouseMotionEvent! Instead, mouse motion event methods useMouseEventobjects. See Writing a Mouse Listener for information about the
MouseEventclass.
|
|
GUI Changes: The AWT Grows Up |