|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.hws.jcm.draw.Drawable
edu.hws.jcm.draw.DrawBorder
public class DrawBorder
A DrawBorder object is just a simple border around the edges of its CoordinateRect, with a specified width, in pixels, and a specified color.
Field Summary | |
---|---|
protected java.awt.Color |
color
A non-null Color, giving the color of the bortder. |
protected int |
width
A non-negative integer giving the width of the border in pixels. |
Fields inherited from class edu.hws.jcm.draw.Drawable |
---|
canvas, coords |
Constructor Summary | |
---|---|
DrawBorder()
Create a black border that is one pixel thick. |
|
DrawBorder(java.awt.Color color,
int width)
Create a border with the spcified color and width. |
Method Summary | |
---|---|
void |
draw(java.awt.Graphics g,
boolean changed)
Draw the border in the given graphics context. |
java.awt.Color |
getColor()
Get the color of the border. |
int |
getWidth()
Get the width of the border, in pixels. |
void |
setColor(java.awt.Color c)
Set the color of the border to the specified color. |
void |
setWidth(int w)
Set the width of the border to be w pixels. |
Methods inherited from class edu.hws.jcm.draw.Drawable |
---|
getVisible, needsRedraw, setOwnerData, setVisible |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.awt.Color color
protected int width
Constructor Detail |
---|
public DrawBorder()
public DrawBorder(java.awt.Color color, int width)
Method Detail |
---|
public java.awt.Color getColor()
public void setColor(java.awt.Color c)
public int getWidth()
public void setWidth(int w)
w
- the desired width for the border.public void draw(java.awt.Graphics g, boolean changed)
draw
in class Drawable
g
- The graphics context in which the Drawble is to be drawn. (The drawing
can change the color in g, but should not permanently change font, painting mode, etc.
Thus, every drawable is responsible for setting the color it wants to use.)changed
- Indicates whether the CoordinateRect has changed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |