|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectellipseTool
public class ellipseTool
This is a class for the ellipse tool which is located at row 8 column 1 of the drawing icon. It allows us to draw an ellipse in 3 ways, a left color border with white background, a left color border with left background or a left color border with right color background. It also allows us to draw the ellipse horizontally or vertically according to the mouse button clicked. It should work with all operating systems and hardware. There are no variances and no security constraints.
Field Summary | |
---|---|
private java.awt.image.BufferedImage |
backupImage
This is used to store the back up image that we want and then, we are going to modify this as we continue the drawing of the ellipse. |
private java.awt.image.BufferedImage |
curImage
Stores the current BufferedImage of the main_canvas. |
private boolean |
dragged
Boolean which indicates whether the mouse has been dragged or not, once clicked. |
private int |
fillType
Represents which of the 3 ways the ellipse will be drawn: a left color border with white background, left color border with left background or a left color border with right color background. |
(package private) int |
prevX
This int holds the value of the Previous X coordinate. |
(package private) int |
prevY
This int holds the value of the Previous Y coordinate. |
int |
startX
Stores the starting x coordinate of the location where the mouse is clicked. |
int |
startY
Stores the starting y coordinate of the location where the mouse is clicked. |
Constructor Summary | |
---|---|
ellipseTool()
|
Method Summary | |
---|---|
void |
clickAction(java.awt.event.MouseEvent mevt,
main_canvas theCanvas)
Allows the user to click on the cavas using the ellipseTool. |
void |
dragAction(java.awt.event.MouseEvent mevt,
main_canvas theCanvas)
Allows the user to draw an ellipse and drag it to the preferred size. |
void |
drawEllipse(java.awt.event.MouseEvent mevt,
java.awt.Graphics2D g2D,
main_canvas theCanvas)
Performs the drawing of the ellipse. |
boolean |
getDragged()
Returns a boolean reflecting the current state of the private data member dragged. |
int |
getFillType()
Returns the fillType of the ellipseTool as an int. |
void |
mouseReleaseAction(java.awt.event.MouseEvent mevt,
main_canvas theCanvas)
Allows the user to release the mouse, once it has been clicked by the user, to stop enlarging or shrinking the ellipse. |
void |
setFillType(int theFillType)
Sets the fillType of ellipse, specified by the int passed in: a left color border with white background, a left color border with left background or a left color border with right color background. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public int startX
public int startY
private boolean dragged
private int fillType
private java.awt.image.BufferedImage curImage
private java.awt.image.BufferedImage backupImage
int prevX
int prevY
Constructor Detail |
---|
public ellipseTool()
Method Detail |
---|
public void clickAction(java.awt.event.MouseEvent mevt, main_canvas theCanvas)
clickAction
in interface ourTool
mevt
- a MouseEvent object which is carried out when the mouse is
clicked.theCanvas
- a main_canvas object which is the area where the graphic is
drawn.public void dragAction(java.awt.event.MouseEvent mevt, main_canvas theCanvas)
dragAction
in interface ourTool
mevt
- This MouseEvent object determines which of the button is
clicked and will draw the ellipse horizontally or vertically.theCanvas
- This is the area where the ellipse is drawn.public boolean getDragged()
public void mouseReleaseAction(java.awt.event.MouseEvent mevt, main_canvas theCanvas)
mouseReleaseAction
in interface ourTool
mevt
- This MouseEvent object determines which of the button is
clicked and will draw the ellipse horizontally or vertically.theCanvas
- This is the area where the ellipse is drawn.public void setFillType(int theFillType)
theFillType
- an int value.getFillType()
public int getFillType()
setFillType(int)
public void drawEllipse(java.awt.event.MouseEvent mevt, java.awt.Graphics2D g2D, main_canvas theCanvas)
mevt
- This MouseEvent object determines which of the button is
clicked and will draw the ellipse horizontally or vertically.g2D
- a Graphic objct to draw the ellipse.theCanvas
- This is the area where the ellipse is drawn.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |