|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjecteraserTool
public class eraserTool
This is a class for the eraser tool which is located at row 2 column 1 of the drawing icon. It allows the user to erase what has been drawn. It should work with all operating systems and hardware. There are no variances and no security constraints.
Field Summary | |
---|---|
(package private) java.awt.image.BufferedImage |
eraseImage
Holds the BufferedImage that we use to create the graphic to do the erasing. |
int |
eraserSize
Holds the size of the eraser. |
(package private) java.awt.Graphics2D |
g2D
Holds the graphic that is actually used to erase. |
(package private) int |
prevX
used to initialize the start of the x and y values. |
(package private) int |
prevY
used to initialize the start of the x and y values. |
Constructor Summary | |
---|---|
eraserTool()
Creates an eraserTool and initializes its size to 6. |
Method Summary | |
---|---|
void |
clickAction(java.awt.event.MouseEvent mevt,
main_canvas theCanvas)
Allows the user to click on the canvas using the eraserTool. |
void |
dragAction(java.awt.event.MouseEvent mevt,
main_canvas theCanvas)
Allows the user to drag the mouse using the eraserTool, and therefore, allows the user to erase until the mouse is released. |
java.awt.Shape |
getEraserShape(int x,
int y)
Returns the Shape of the eraserTool, as specified by the x and y values passed in. |
int |
getEraserSize()
Returns the size of the eraser as an int. |
java.awt.Color |
getG2dColor()
This function returns the color set to the private data member g2d. |
void |
mouseReleaseAction(java.awt.event.MouseEvent mevt,
main_canvas theCanvas)
Allows the user to release the mouse, and therefore stop the erasing process. |
void |
setEraserSize(int newSize)
Sets the size of the eraser, as specified by the int parameter passed in. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
java.awt.Graphics2D g2D
java.awt.image.BufferedImage eraseImage
public int eraserSize
int prevX
int prevY
Constructor Detail |
---|
public eraserTool()
Method Detail |
---|
public void clickAction(java.awt.event.MouseEvent mevt, main_canvas theCanvas)
clickAction
in interface ourTool
mevt
- A MouseEvent object for showing which button in the mouse is clicked and the
coordinate of where the mouse is clicked.theCanvas
- A main_canvas object which is the area that we are going to erase.public void dragAction(java.awt.event.MouseEvent mevt, main_canvas theCanvas)
dragAction
in interface ourTool
mevt
- A MouseEvent object for showing which button in the mouse is clicked and the
coordinate of where the mouse is clicked.theCanvas
- A main_canvas object which is the area that we are going to erase.public void mouseReleaseAction(java.awt.event.MouseEvent mevt, main_canvas theCanvas)
mouseReleaseAction
in interface ourTool
mevt
- A MouseEvent object for showing which button in the mouse is clicked and the
coordinate of where the mouse is clicked.theCanvas
- A main_canvas object which is the area that we are going to erase.public java.awt.Color getG2dColor()
public java.awt.Shape getEraserShape(int x, int y)
x
- for x coordinate.y
- for y coordinate.
public void setEraserSize(int newSize)
newSize
- int value.getEraserSize()
public int getEraserSize()
setEraserSize(int)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |