|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Cursor
jview.CanvasCursor
jview.CrossCursor
public abstract class CrossCursor
A cursor-like application that supplies a cross-hair above the entire
drawable area of a JShapeCanvas. If persitant marking is enabled with
the KEY_PERSISTENT key, then clicking on the canvas adds a
cross-hair on the location clicked to the shape canvas.
| Nested Class Summary | |
|---|---|
static class |
CrossCursor.Draw
|
| Field Summary | |
|---|---|
protected Color |
cursorcolor
The color of the cursor, cached for speed. |
private JLabel |
cursorcoordinates
An extra label where the current coordinates should be writtn. |
private static boolean |
DEFSHOWCOORDINATE
The default cursor position marking. |
private static int |
DEFXSHIFT
The shift from the mouse position to basline of position, pixel. |
private static int |
DEFYSHIFT
The shift from the mouse position to basline of position, pixel. |
static String |
KEY_ALLOWDRAG
If true, dragging draws an outlining rectangle. |
static String |
KEY_ANGLESIZE
The half size of the bounding rectangle of the angle arc. |
static String |
KEY_PERSISTENT
If true, clicking adds permanent cross-hairs. |
static String |
KEY_SHOWCOORDINATE
If true, the current cursor position is marked. |
static String |
KEY_SINGLEPERSIST
If true, one a single persistent is active. |
static String |
KEY_XSHIFT
The shift from the mouse position to basline of position, pixel. |
static String |
KEY_YSHIFT
The shift from the mouse position to basline of position, pixel. |
protected Point |
lastcenter
The center of the last cross drawn. |
protected String |
lastposition
The last cursor position writtn. |
protected NumberFormat |
xformat
If we have a decimal formatter on the canvas for x-labels. |
protected NumberFormat |
yformat
If we have a decimal formatter on the canvas for y-labels. |
| Fields inherited from class jview.CanvasCursor |
|---|
canvas, DEFCURSORCOLOR, KEY_COORDINATES, KEY_CURSORCOLOR, KEY_CURSORNAME, KEY_CURSORSIZE, NORMALIZED, NORMALIZEDACTION, SCREEN, SCREENACTION, USER, USERACTION |
| Fields inherited from class java.awt.Cursor |
|---|
CROSSHAIR_CURSOR, CUSTOM_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, MOVE_CURSOR, N_RESIZE_CURSOR, name, NE_RESIZE_CURSOR, NW_RESIZE_CURSOR, predefined, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR |
| Constructor Summary | |
|---|---|
protected |
CrossCursor(PropertySupplying prop)
Constructs a new cross cursor from properties. |
| Method Summary | |
|---|---|
protected void |
clearOnRepaint(Graphics2D g2d)
Updates the canvas in its own thread. |
protected void |
drawCross(Graphics onto,
Point center)
Draw a cursor cross. |
protected void |
drawPosition(Graphics onto,
String cor,
Point center)
Draws a position string. |
JLabel |
getCoordinateLabel()
Returns the label the cursor displays its current coordinates in or null if not set. |
protected String |
getCoordinates(Point mouse)
Converts the pixel coordinates to a single string. |
protected String |
getCoordinatesPair(String xcor,
String ycor)
Packs the x and y string together to form a single displayable string. |
void |
mouseEntered(MouseEvent me)
When the mouse enters, we cache the up-left point and the size of the canvas, hoping that resizing events take only place when the mouse is not pointing within the canvas. |
void |
mouseExited(MouseEvent me)
When the mouse exits the component, we check if we have everything deleted. |
void |
mouseMoved(MouseEvent me)
When the mouse is moved, we check if we are inside the active rectangle. |
void |
setComposedProperties(PropertySupplying info)
Compose with a PropertySupplying as we need subclassing Cursor. |
void |
setCoordinateFormat(NumberFormat forx,
NumberFormat fory)
Sets the formatters |
void |
setCoordinateLabel(JLabel coor)
Sets an extra label for coordinate display. |
| Methods inherited from class jview.CanvasCursor |
|---|
disableCanvas, enableCanvas, getActions, getComposedProperties, getCursorName, getCursorShape, getCustomized, getNormalizedAction, getScreenAction, getUserAction, init, isConsider, isMe, isWithin, repaintCanvas, setCursorName, setCursorShape |
| Methods inherited from class java.awt.Cursor |
|---|
getDefaultCursor, getName, getPredefinedCursor, getSystemCustomCursor, getType, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.awt.event.MouseListener |
|---|
mouseClicked, mousePressed, mouseReleased |
| Methods inherited from interface java.awt.event.MouseMotionListener |
|---|
mouseDragged |
| Field Detail |
|---|
public static final String KEY_PERSISTENT
public static final String KEY_SINGLEPERSIST
public static final String KEY_ALLOWDRAG
public static final String KEY_SHOWCOORDINATE
public static final String KEY_XSHIFT
public static final String KEY_YSHIFT
public static final String KEY_ANGLESIZE
private static final boolean DEFSHOWCOORDINATE
private static final int DEFXSHIFT
private static final int DEFYSHIFT
protected Point lastcenter
protected String lastposition
protected NumberFormat xformat
protected NumberFormat yformat
protected Color cursorcolor
private JLabel cursorcoordinates
| Constructor Detail |
|---|
protected CrossCursor(PropertySupplying prop)
JShapeCanvas manually.
| Method Detail |
|---|
public void setComposedProperties(PropertySupplying info)
PropertySupplying as we need subclassing Cursor.
setComposedProperties in interface PropertyAwaresetComposedProperties in class CanvasCursor
public void setCoordinateFormat(NumberFormat forx,
NumberFormat fory)
public void setCoordinateLabel(JLabel coor)
public JLabel getCoordinateLabel()
public void mouseEntered(MouseEvent me)
mouseEntered in interface MouseListenerpublic void mouseMoved(MouseEvent me)
mouseMoved in interface MouseMotionListenerpublic void mouseExited(MouseEvent me)
mouseExited in interface MouseListener
protected String getCoordinatesPair(String xcor,
String ycor)
protected String getCoordinates(Point mouse)
Morphing instance, transfer it into coordinate space.
protected void drawCross(Graphics onto,
Point center)
protected void drawPosition(Graphics onto,
String cor,
Point center)
protected void clearOnRepaint(Graphics2D g2d)
clearOnRepaint in class CanvasCursor
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||