|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jwo.utils.gui.JWRubberband
public class JWRubberband
Draws a rubberband box for interactive selection of rectangular regions with the mouse.
Field Summary | |
---|---|
static int |
BOX
Identifies rubberband box. |
static int |
LINE
Identifies linear rubberband. |
Constructor Summary | |
---|---|
JWRubberband(Component component)
Initialises rubberband box with the component to draw on and a default rubberband colour. |
|
JWRubberband(Component component,
boolean line)
Initialises rubberband feature with the component to draw on and a default rubberband colour. |
|
JWRubberband(Component component,
Color boxColour)
Initialises rubberband box with the component to draw on and the given colour. |
|
JWRubberband(Component component,
Color boxColour,
boolean line)
Initialises rubberband feature with the component to draw on and the given colour. |
Method Summary | |
---|---|
Rectangle |
getLine()
Returns the current bounding box of the rubberband line, which is the final one if this is called after mouseUp. |
Rectangle |
getRectangle()
Returns the current bounding box of the rubberband, which is the final one if this is called after mouseUp. |
void |
mouseDown(int x,
int y)
Identifies corner of rectangle. |
void |
mouseDrag(int x,
int y)
Identifies current active corner/end of rubberband. |
void |
mouseUp(int x,
int y)
Identifies closing corner/end of rubberband and erases it from component. |
void |
mouseUp(int x,
int y,
boolean visible)
Identifies closing corner/end of rubberband. |
void |
setLeave(boolean leave)
Determines if rubberband is left on component when mouse is released. |
void |
setRubberbandColour(Color boxColour)
Changes the colour of the rubberband box. |
void |
setType(int type)
Sets the rubberband to either a box or a line. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int LINE
public static final int BOX
Constructor Detail |
---|
public JWRubberband(Component component)
component
- Component on which to draw the rubberband.public JWRubberband(Component component, boolean line)
component
- Component on which to draw the rubberband.line
- Rubberband line drawn if true, box if false.public JWRubberband(Component component, Color boxColour)
component
- Component on which to draw the rubberband.boxColour
- Colour of rubberband box.public JWRubberband(Component component, Color boxColour, boolean line)
component
- Component on which to draw the rubberband.boxColour
- Colour of rubberband box.line
- Rubberband line drawn if true, box if false.Method Detail |
---|
public void setRubberbandColour(Color boxColour)
boxColour
- New colour for the rubberband box.public void setType(int type)
type
- Type of rubberband feature (BOX or LINE).public void setLeave(boolean leave)
leave
- Rubberband is left if set to true, erased if false.public Rectangle getRectangle()
public Rectangle getLine()
public void mouseDown(int x, int y)
x
- x-coordinate of rubberband box corner.y
- y-coordinate of rubberband box corner.public void mouseDrag(int x, int y)
x
- x-coordinate of rubberband active corner.y
- y-coordinate of rubberband active corner.public void mouseUp(int x, int y)
x
- x-coordinate of rubberband box corner.y
- y-coordinate of rubberband box corner.public void mouseUp(int x, int y, boolean visible)
x
- x-coordinate of rubberband box corner.y
- y-coordinate of rubberband box corner.visible
- Rubberband is left on component if true, erased if false.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |