vmm3d.core
Class TwoPointInput
- java.lang.Object
-
- vmm3d.core.MouseTask
-
- vmm3d.core.TwoPointInput
-
public abstract class TwoPointInput extends MouseTask
Meant for use as a "one-shot" mouse task that lets the user specify two points by clicking and dragging. The first point is where the mouse is pressed, the second is where the mouse is released.
-
-
Field Summary
Fields Modifier and Type Field and Description static intDRAW_CIRCLE_FROM_DIAMETERstatic intDRAW_CIRCLE_FROM_RADIUSstatic intDRAW_LINEstatic intDRAW_NOTHINGstatic intDRAW_RECT
-
Constructor Summary
Constructors Constructor and Description TwoPointInput()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleandoMouseDown(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.voiddoMouseDrag(java.awt.event.MouseEvent evt, Display display, View view, int width, int height)Continue processing a mouse gesture for whichdoMouseDownreturned a value of true.voiddoMouseUp(java.awt.event.MouseEvent evt, Display display, View view, int width, int height)Finish processing a mouse gesture for whichdoMouseDownreturned a value of true.voiddrawWhileDragging(org.freehep.graphics2d.VectorGraphics 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.booleangetAllowOutOfBoundsDrag()java.awt.CursorgetCursor(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.ColorgetDrawColor()intgetFigureToDraw()intgetMaximumDrag()intgetMinimumDrag()voidsetAllowOutOfBoundsDrag(boolean allowOutOfBoundsDrag)voidsetDrawColor(java.awt.Color drawColor)voidsetFigureToDraw(int figureToDraw)voidsetMaximumDrag(int maximumDrag)voidsetMinimumDrag(int minimumDrag)-
Methods inherited from class vmm3d.core.MouseTask
finish, getCursorForDragging, getStatusText, start, wantsMoreClicks
-
-
-
-
Field Detail
-
DRAW_NOTHING
public static final int DRAW_NOTHING
- See Also:
- Constant Field Values
-
DRAW_LINE
public static final int DRAW_LINE
- See Also:
- Constant Field Values
-
DRAW_CIRCLE_FROM_RADIUS
public static final int DRAW_CIRCLE_FROM_RADIUS
- See Also:
- Constant Field Values
-
DRAW_CIRCLE_FROM_DIAMETER
public static final int DRAW_CIRCLE_FROM_DIAMETER
- See Also:
- Constant Field Values
-
DRAW_RECT
public static final int DRAW_RECT
- See Also:
- Constant Field Values
-
-
Method Detail
-
getAllowOutOfBoundsDrag
public boolean getAllowOutOfBoundsDrag()
-
setAllowOutOfBoundsDrag
public void setAllowOutOfBoundsDrag(boolean allowOutOfBoundsDrag)
-
getDrawColor
public java.awt.Color getDrawColor()
-
setDrawColor
public void setDrawColor(java.awt.Color drawColor)
-
getFigureToDraw
public int getFigureToDraw()
-
setFigureToDraw
public void setFigureToDraw(int figureToDraw)
-
getMaximumDrag
public int getMaximumDrag()
-
setMaximumDrag
public void setMaximumDrag(int maximumDrag)
-
getMinimumDrag
public int getMinimumDrag()
-
setMinimumDrag
public void setMinimumDrag(int minimumDrag)
-
doMouseDown
public boolean doMouseDown(java.awt.event.MouseEvent evt, Display display, View view, int width, int height)Description copied from class:MouseTaskCalled when the user presses the mouse in the Display in which this MouseTask is installed. The return value indicates whether or not the MouseTask wants to recieve the mouse drag and mouse up events that follow the mouse down event. If the return value is false, then the Display will not call the other two methods. This is an abstract method that must be redefined in a subclass. It should not be necessary to call this method directly.- Specified by:
doMouseDownin classMouseTask- Parameters:
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).
-
doMouseDrag
public void doMouseDrag(java.awt.event.MouseEvent evt, Display display, View view, int width, int height)Description copied from class:MouseTaskContinue processing a mouse gesture for whichdoMouseDownreturned a value of true. If not redefined in a subclass, this method does nothing.- Overrides:
doMouseDragin classMouseTask- Parameters:
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).
-
doMouseUp
public void doMouseUp(java.awt.event.MouseEvent evt, Display display, View view, int width, int height)Description copied from class:MouseTaskFinish processing a mouse gesture for whichdoMouseDownreturned a value of true. If not redefined in a subclass, does nothing.- Overrides:
doMouseUpin classMouseTask- Parameters:
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).
-
drawWhileDragging
public void drawWhileDragging(org.freehep.graphics2d.VectorGraphics g, Display display, View view, int width, int height)Description copied from class:MouseTaskWhen 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. The graphics context is a newly created one, which has been translated and clipped, if necessary, to account for any border that has been applied to the Display. The width and height parameters give the width and height of the drawing area, in pixels.- Overrides:
drawWhileDraggingin classMouseTask
-
getCursor
public java.awt.Cursor getCursor(Display display, View view)
Description copied from class:MouseTaskReturn a cursor to be used in the display when this MouseTask is installed and waiting for a mouse-down event. If the return value is null, the default cursor will be used. If not redefined in a subclass, returns null.- Overrides:
getCursorin classMouseTask- See Also:
MouseTask.getCursorForDragging(MouseEvent, Display, View)
-
-
DMelt 3.0 © DataMelt by jWork.ORG