|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectpencilTool
public class pencilTool
A pencilTool implements the operations performed by a pencil. It holds the fields int prevX and prevY, BufferedImage pencilImage and Graphics2D g2D. The variables prevX and prevY retain the values of x and y at the end of the methods clickAction and DragAction. It should work with all operating systems and hardware. There are no variances and no security constraints.
Field Summary | |
---|---|
(package private) java.awt.Graphics2D |
g2D
holds a Graphics2D. |
(package private) java.awt.image.BufferedImage |
pencilImage
holds a BufferedImage. |
(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 | |
---|---|
pencilTool()
Creates a pencilTool object. |
Method Summary | |
---|---|
void |
clickAction(java.awt.event.MouseEvent mevt,
main_canvas theCanvas)
Allows the user to click the mouse, using the pencilTool. |
void |
dragAction(java.awt.event.MouseEvent mevt,
main_canvas theCanvas)
Allows the user to drag the mouse, using the pencil tool once the mouse has been clicked. |
int |
getPrevX()
Returns the value of the data member prevX. |
int |
getPrevY()
Returns the value of the data member prevY. |
java.awt.Stroke |
getStroke()
Returns the Stroke of g2d. |
void |
mouseReleaseAction(java.awt.event.MouseEvent mevt,
main_canvas theCanvas)
Allows the user to release the mouse, using the pencilTool, once the mouse has been clicked on and clickAction has been called. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
java.awt.image.BufferedImage pencilImage
java.awt.Graphics2D g2D
int prevX
int prevY
Constructor Detail |
---|
public pencilTool()
Method Detail |
---|
public void clickAction(java.awt.event.MouseEvent mevt, main_canvas theCanvas)
clickAction
in interface ourTool
mevt
- holds a MouseEvent to call getX() and getY() to set the
x and y valuestheCanvas
- holds a main_canvas to retrieve the mevt's x and y values.public int getPrevX()
public int getPrevY()
public void dragAction(java.awt.event.MouseEvent mevt, main_canvas theCanvas)
dragAction
in interface ourTool
mevt
- holds a MouseEvent to call getX() and getY() to set the x and y values.theCanvas
- holds a main_canvas to retrieve the mevt's x and y values and
left and right colors.public void mouseReleaseAction(java.awt.event.MouseEvent mevt, main_canvas theCanvas)
mouseReleaseAction
in interface ourTool
mevt
- mevt holds a MouseEvent to call getX() and getY() to set the x and y values.theCanvas
- holds a main_canvas to retrieve the mevt's x and y values and left
and right colors.public java.awt.Stroke getStroke()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |