|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectPen
public class Pen
Class to represent a pen which has a color, width, and a list of path segments that it should draw. A pen also knows if it is up or down Copyright Georgia Institute of Technology 2004
| Constructor Summary | |
|---|---|
Pen()
Constructor that takes no arguments |
|
Pen(Color color,
int width)
Constructor that takes all the ink color, and width |
|
Pen(Color color,
int width,
boolean penDown)
Constructor that takes the ink color, width, and penDown flag |
|
| Method Summary | |
|---|---|
void |
addMove(int x1,
int y1,
int x2,
int y2)
Method to add a path segment if the pen is down |
void |
clearPath()
Method to clear the path stored for this pen |
Color |
getColor()
Method to get the pen (ink) color |
int |
getWidth()
Method to get the width of the pen |
boolean |
isPenDown()
Method to get pen down status |
void |
paintComponent(Graphics g)
Metod to paint the pen path |
void |
setColor(Color color)
Method to set the pen (ink) color |
void |
setPenDown(boolean value)
Method to set the pen down value |
void |
setWidth(int width)
Method to set the width of the pen |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Pen()
public Pen(Color color,
int width)
color - the ink colorwidth - the width in pixels
public Pen(Color color,
int width,
boolean penDown)
color - the ink colorwidth - the width in pixelspenDown - the flag if the pen is down| Method Detail |
|---|
public boolean isPenDown()
public void setPenDown(boolean value)
value - the new value to usepublic Color getColor()
public void setColor(Color color)
color - the color to usepublic int getWidth()
public void setWidth(int width)
width - the width to use in pixels
public void addMove(int x1,
int y1,
int x2,
int y2)
x1 - the first xy1 - the first yx2 - the second xy2 - the second ypublic void clearPath()
public void paintComponent(Graphics g)
g - the graphics context
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||