Prev Up
Go backward to The mouseMove Method
Go up to Methods for Handling Events

The mouseDrag Method


void mouseDrag( ) { ... }

void mouseDrag( int x, int y) { ... }

void mouseDrag( int fromX, int fromY, int toX, int toY) { ... }

The "mouseDrag" method is invoked automatically each time the user moves the mouse with the mouse button depressed after depressing the mouse button while the mouse was positioned within the region of the screen controlled by the applet. Three versions of this event handling method's parameterization are possible. If four parameters are expected the browser will provide the x and y coordinates of the point from which the mouse was dragged followed by the x and y coordinates of the point to which the mouse was dragged. Note that these points are unlikely to be adjacent. The computer checks the position of the mouse frequently and periodically but not continuously. If the mouse is moved reasonably quickly, the positions reported by "mouseDrag" will typically be separated by many pixels.

If only two parameters are expected, the browser simply provides the x and y coordinates of the position to which the mouse was dragged. Finally, if no coordinates are expected, the browser simply invokes the method to notify the applet of the user's activity.


Prev Up