Class sprayTool

java.lang.Object
  extended by sprayTool
All Implemented Interfaces:
ourTool

public class sprayTool
extends java.lang.Object
implements ourTool

sprayTool is basically a tool which acts like a spraycan to spray onto the image the selected color. There are three sizes: small, medium, large. These sizes indicate how big of the diameter you want the spray to take up on the image. This tool works in all operating systems. There are no variances known. Also there are no security constraints known. No references to external specifications.


Field Summary
(package private)  java.awt.image.BufferedImage sprayImage
          This is a BufferedImage.
(package private)  int sprayType
          This integer is initially set at 8.
(package private)  java.awt.Color theColor
          This is of class type Color.
 
Constructor Summary
sprayTool()
          Creates a sprayTool object.
 
Method Summary
 void clickAction(java.awt.event.MouseEvent mevt, main_canvas theCanvas)
          Allows the user to click on the canvas, using the spray tool.
 void dragAction(java.awt.event.MouseEvent mevt, main_canvas theCanvas)
          Allows the user to drag the spraying action.
 int getSprayType()
          Returns the spray type of the can as an int.
 void mouseReleaseAction(java.awt.event.MouseEvent mevt, main_canvas theCanvas)
          Allows the user to release the mouse, and therefore stop spraying.
 void setSprayType(int newSprayType)
          Sets the diameter of the spray can to the int passed in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sprayType

int sprayType
This integer is initially set at 8. This means the default setting for the spray tool is the smallest diameter possible.


sprayImage

java.awt.image.BufferedImage sprayImage
This is a BufferedImage. Whatever is sprayed using this tool, it is then buffered into the BufferedImage.


theColor

java.awt.Color theColor
This is of class type Color. The variable takes in which color will be sprayed forth from the spray tool.

Constructor Detail

sprayTool

public sprayTool()
Creates a sprayTool object. It takes in no parameters or null arguments. It does not return anything. There are no algorithms of any kind and no variances and OS dependencies. There should not be any exceptions or security constraints.

Method Detail

clickAction

public void clickAction(java.awt.event.MouseEvent mevt,
                        main_canvas theCanvas)
Allows the user to click on the canvas, using the spray tool. The MouseEvent holds the coordinates where the mouse was clicked, to begin spraying. Once the mouse is clicked, there is an algorithm which calculates using a random variable where exactly to "spray". There are no OS dependencies or variances. No exceptions and security constraints.

Specified by:
clickAction in interface ourTool
Parameters:
mevt - This variable knows which button was clicked on the mouse. Left or right.
theCanvas - This is the main canvas where the mouse will click.

dragAction

public void dragAction(java.awt.event.MouseEvent mevt,
                       main_canvas theCanvas)
Allows the user to drag the spraying action. First, the mouse must click on the canvas and call clickAction. Once the mouse is dragged, there is an algorithm which calculates using a random variable where exactly to "spray". It will keep spraying each time the mouse moves (or being dragged). There are no OS dependencies or variances. No exceptions and security constraints.

Specified by:
dragAction in interface ourTool
Parameters:
mevt - This variable knows which button was clicked on the mouse. Left or right.
theCanvas - This is the main canvas where the mouse will click.

mouseReleaseAction

public void mouseReleaseAction(java.awt.event.MouseEvent mevt,
                               main_canvas theCanvas)
Allows the user to release the mouse, and therefore stop spraying. The method was unnecessary to implement, but was defined since sprayTool implements OurTool. There are no OS dependencies or variances. No exceptions and security constraints.

Specified by:
mouseReleaseAction in interface ourTool
Parameters:
mevt - This variable knows which button was clicked on the mouse. Left or right.
theCanvas - This is the main canvas where the mouse will click.

setSprayType

public void setSprayType(int newSprayType)
Sets the diameter of the spray can to the int passed in.

Parameters:
newSprayType - This variable is the spray diameter you want.
See Also:
getSprayType()

getSprayType

public int getSprayType()
Returns the spray type of the can as an int.

Returns:
int representing the spray type
See Also:
setSprayType(int)