|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object vmm.core.MouseTask
public abstract class MouseTask
A MouseTask can be installed in a Display
to respond
to a mouse gesture starting from
a mouse press, through a sequence of mouse drags, and ending
with a mouse release. It has access to the mouse events and
to the Display object and View objects that were clicked, and through the View
object, it has access to the Exhibit
in the View.
Display.installMouseTask(MouseTask)
Constructor Summary | |
---|---|
MouseTask()
|
Method Summary | |
---|---|
abstract boolean |
doMouseDown(java.awt.event.MouseEvent evt,
Display display,
View view,
int width,
int height)
Called when the user presses the mouse in the Display in which this MouseTask is installed. |
void |
doMouseDrag(java.awt.event.MouseEvent evt,
Display display,
View view,
int width,
int height)
Continue processing a mouse gesture for which doMouseDown
returned a value of true. |
void |
doMouseUp(java.awt.event.MouseEvent evt,
Display display,
View view,
int width,
int height)
Finish processing a mouse gesture for which doMouseDown
returned a value of true. |
void |
drawWhileDragging(java.awt.Graphics2D g,
Display display,
View view,
int width,
int height)
When the Display is repainted during a drag operation, this method will be called after the Exhibit is drawn, to give the MouseTask a chance to draw some extra stuff on top of the Exhibit. |
void |
finish(Display display,
View view)
This method is called by a Display when this MouseTask is removed from the Display, to give the MouseTask a chance to do any display-specific clean-up (such as removing a decoration). |
java.awt.Cursor |
getCursor(Display display,
View view)
Return a cursor to be used in the display when this MouseTask is installed and waiting for a mouse-down event. |
java.awt.Cursor |
getCursorForDragging(java.awt.event.MouseEvent mouseDownEvent,
Display display,
View view)
When doMouseDown returns true, the Display class calls this method to
determine which cursor to use during dragging. |
java.lang.String |
getStatusText()
Returns a string to be displayed in the status bar while this mouse task is active, or null to use the default text. |
void |
start(Display display,
View view)
This method is called by a Display when this MouseTask is installed in the Display, to give the MouseTask a chance to do any display-specific initialization (such as adding a decoration). |
boolean |
wantsMoreClicks(Display display,
View view)
This method is called by a Display immediately after processing a click or click-and-drag for a one-shot mouse task to test whether the one-shot mouse task wants to receive additional mouse events. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MouseTask()
Method Detail |
---|
public abstract boolean doMouseDown(java.awt.event.MouseEvent evt, Display display, View view, int width, int height)
evt
- The mouse-down event, except that the x and y coordinates
have been translated so that the top left corner of the View is at
coordinates (0,0).width
- The width the drawing area (not including any insets).height
- The height the drawing area (not including any insets).public void doMouseDrag(java.awt.event.MouseEvent evt, Display display, View view, int width, int height)
doMouseDown
returned a value of true. If not redefined in a subclass, this method
does nothing.
evt
- The mouse-dragged event, except that the x and y coordinates
have been translated by display.getInsets().left and display.getInsets().top
to account for any border that has been applied to the display.width
- The width the drawing area (not including any insets).height
- The height the drawing area (not including any insets).public void doMouseUp(java.awt.event.MouseEvent evt, Display display, View view, int width, int height)
doMouseDown
returned a value of true. If not redefined in a subclass,
does nothing.
evt
- The mouse-up event, except that the x and y coordinates
have been translated by display.getInsets().left and display.getInsets().top
to account for any border that has been applied to the display.width
- The width the drawing area (not including any insets).height
- The height the drawing area (not including any insets).public void start(Display display, View view)
public void finish(Display display, View view)
public java.awt.Cursor getCursor(Display display, View view)
getCursorForDragging(MouseEvent, Display, View)
public java.awt.Cursor getCursorForDragging(java.awt.event.MouseEvent mouseDownEvent, Display display, View view)
doMouseDown
returns true, the Display class calls this method to
determine which cursor to use during dragging. The first parameter
is the same mouseDownEvent that was passed to doMouseDown
; it can
can be used to decide the appropriate cursor. The version in
this class simply returns "getCursor(display)". Override it if
you want the possibility of using a different cursor during dragging.
doMouseDown(MouseEvent, Display, View, int, int)
,
getCursor(Display, View)
public void drawWhileDragging(java.awt.Graphics2D g, Display display, View view, int width, int height)
public boolean wantsMoreClicks(Display display, View view)
getCursor
method immediately after calling this method;
a one-shot MouseTask that processes more than one click could use a distinctive
cursor to help the user know what is going on, and it should consider setting the
status bar text to tell the user what is going on.
Display.installOneShotMouseTask(MouseTask)
,
getStatusText()
public java.lang.String getStatusText()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |