Class brushTool

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

public class brushTool
extends java.lang.Object
implements ourTool

This class is the Brush Tool. It controls what the brush does. It controls the color, the position and the shape. The object state should be enable. OS is windows. NO implementation variance is allowed. There are no security constaints. There are no external secification.


Field Summary
(package private)  java.awt.image.BufferedImage brushImage
          this is a BufferedImage variable.
 int brushType
          Stores the type of the brush (1-12).
 int DOT1
          this is a int variable.
 int DOT2
          this is a int variable.
 int DOT3
          this is a int variable.
(package private)  java.awt.Graphics2D g2D
          this is a Graphics2D variable.
 int LEFT1
          this is a int variable.
 int LEFT2
          this is a int variable.
 int LEFT3
          this is a int variable.
private  int prevX
          Stores the previous x.
private  int prevY
          Stores the previous y.
 int RIGHT1
          this is a int variable.
 int RIGHT2
          this is a int variable.
 int RIGHT3
          this is a int variable.
 int SQUARE1
          this is a int variable.
 int SQUARE2
          this is a int variable.
 int SQUARE3
          this is a int variable.
 
Constructor Summary
brushTool()
          Creates a brushTool with the brushType initialized to DOT1 by calling super() and setBrushType() to initialize brushType.
 
Method Summary
 void clickAction(java.awt.event.MouseEvent mevt, main_canvas theCanvas)
          This method controls the colors when you click left or right.
 void dragAction(java.awt.event.MouseEvent mevt, main_canvas theCanvas)
          This method controls the position or location of the brush as it is moved by the user.
 java.awt.Shape drawBrush(int x, int y)
          Draws the brush strokes on the canvas according to the width and height of the x and y ints passed in.
 void drawStuff(java.awt.event.MouseEvent mevt, int x, int y, main_canvas theCanvas)
          This method controls all the other methods in order to draw what the user intends to do.
 int getBrushType()
          This method returns the brushType as an int.
 java.awt.Color getG2dColor()
          This method returns the Color of g2d.
 void mouseReleaseAction(java.awt.event.MouseEvent mevt, main_canvas theCanvas)
          Depending on where the user releases the mouse, this method stores the position or location of the brush.
 void setBrushType(int type)
          This method sets the brushtype as specified by the int, type, that is passed in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOT1

public final int DOT1
this is a int variable.

See Also:
Constant Field Values

DOT2

public final int DOT2
this is a int variable.

See Also:
Constant Field Values

DOT3

public final int DOT3
this is a int variable.

See Also:
Constant Field Values

SQUARE1

public final int SQUARE1
this is a int variable.

See Also:
Constant Field Values

SQUARE2

public final int SQUARE2
this is a int variable.

See Also:
Constant Field Values

SQUARE3

public final int SQUARE3
this is a int variable.

See Also:
Constant Field Values

RIGHT1

public final int RIGHT1
this is a int variable.

See Also:
Constant Field Values

RIGHT2

public final int RIGHT2
this is a int variable.

See Also:
Constant Field Values

RIGHT3

public final int RIGHT3
this is a int variable.

See Also:
Constant Field Values

LEFT1

public final int LEFT1
this is a int variable.

See Also:
Constant Field Values

LEFT2

public final int LEFT2
this is a int variable.

See Also:
Constant Field Values

LEFT3

public final int LEFT3
this is a int variable.

See Also:
Constant Field Values

brushImage

java.awt.image.BufferedImage brushImage
this is a BufferedImage variable.


brushType

public int brushType
Stores the type of the brush (1-12).


g2D

java.awt.Graphics2D g2D
this is a Graphics2D variable.


prevX

private int prevX
Stores the previous x.


prevY

private int prevY
Stores the previous y.

Constructor Detail

brushTool

public brushTool()
Creates a brushTool with the brushType initialized to DOT1 by calling super() and setBrushType() to initialize brushType. OS is windows. Implementation variances are not allowed. There are no exceptions There are no security constaints.

Method Detail

clickAction

public void clickAction(java.awt.event.MouseEvent mevt,
                        main_canvas theCanvas)
This method controls the colors when you click left or right. It also controls the position of the brush and the color the user wants. The state transition varies and depends on the user. The argument values are MouseEvent, main_canvas. There are no pointers so NULL is not assigned. There is no return value. Depending on what the user click certain events are called. OS is windows. Implementation variances is not allowed. There are no exceptions. There are no security constraints.

Specified by:
clickAction in interface ourTool
Parameters:
mevt - This is a MouseEvent variable.
theCanvas - this is a main_canvas variable

dragAction

public void dragAction(java.awt.event.MouseEvent mevt,
                       main_canvas theCanvas)
This method controls the position or location of the brush as it is moved by the user. The state transition varies and depends on the user. The argument values are MouseEvent, main_canvas. There are no pointers so NULL is not assigned. There is no return value. Depending on what the user click certain events are called. OS is windows. Implementation variances is not allowed. There are no exceptions. There are no security constraints.

Specified by:
dragAction in interface ourTool
Parameters:
mevt - This is a MouseEvent variable.
theCanvas - this is a main_canvas variable

mouseReleaseAction

public void mouseReleaseAction(java.awt.event.MouseEvent mevt,
                               main_canvas theCanvas)
Depending on where the user releases the mouse, this method stores the position or location of the brush. The state transition varies and depends on the user. The argument values are MouseEvent, main_canvas. There are no pointers so NULL is not assigned. There is no return value. Depending on what the user click certain events are called. OS is windows. Implementation variances is not allowed. There are no exceptions. There are no security constraints.

Specified by:
mouseReleaseAction in interface ourTool
Parameters:
mevt - This is a MouseEvent variable.
theCanvas - this is a main_canvas variable

drawStuff

public void drawStuff(java.awt.event.MouseEvent mevt,
                      int x,
                      int y,
                      main_canvas theCanvas)
This method controls all the other methods in order to draw what the user intends to do. The state transition varies and depends on the user. The argument values are MouseEvent, main_canvas. The argument values are ints. There are no pointers so NULL is not assigned. There is no return value. Depending on what the user click certain events are called. OS is windows. Implementation variances is not allowed. There are no exceptions. There are no security constraints.

Parameters:
mevt - This is a MouseEvent variable.
theCanvas - this is a main_canvas variable
x - this is a int variable
y - this is a int variable

setBrushType

public void setBrushType(int type)
This method sets the brushtype as specified by the int, type, that is passed in. There are no pointers so NULL is not assigned. There is no return value. Depending on what the user click certain events are called. OS is windows. Implementation variances is not allowed. There are no exceptions. There are no security constraints.

Parameters:
type - This is a int variable that represents the brush type.
See Also:
getBrushType()

getBrushType

public int getBrushType()
This method returns the brushType as an int. OS is windows. Implementation variances is not allowed. There are no exceptions. There are no security constraints.

Returns:
int referring to brushType
See Also:
setBrushType(int)

drawBrush

public java.awt.Shape drawBrush(int x,
                                int y)
Draws the brush strokes on the canvas according to the width and height of the x and y ints passed in. The brush strokes are drawn according to the brush shape selected by the user. For example, if the first dot was selected, the stroke of the brush would look like a dot, and be of the smallest possible width. by the user, the brush strokes are drawn The state transition varies and depends on the user. The argument values are ints. There are no pointers so NULL is not assigned. There is no return value. Depending on what the user click certain events are called. OS is windows. Implementation variances is not allowed. There are no exceptions. There are no security constraints.

Parameters:
x - This is a int variable.
y - this is a int variable.
Returns:
returns a Shape variable

getG2dColor

public java.awt.Color getG2dColor()
This method returns the Color of g2d.

Returns:
Color representing the g2d