Package edu.hws.jcm.draw

# Class DrawBorder

java.lang.Object
edu.hws.jcm.draw.Drawable
edu.hws.jcm.draw.DrawBorder

All Implemented Interfaces:
  `Serializable`

public class DrawBorder extends Drawable
A DrawBorder object is just a simple border around the edges of its CoordinateRect, with a specified width, in pixels, and a specified color.

See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`protected 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

Constructors
Constructor
Description
`DrawBorder()`
Create a black border that is one pixel thick.
`DrawBorder(Color color, int width)`
Create a border with the spcified color and width.

## Method Summary

Modifier and Type
Method
Description
`void`
`draw(Graphics g, boolean changed)`
Draw the border in the given graphics context.
`Color`
`getColor()`
Get the color of the border.
`int`
`getWidth()`
Get the width of the border, in pixels.
`void`
`setColor(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 Details

### color

protected Color color
A non-null Color, giving the color of the bortder.

### width

protected int width
A non-negative integer giving the width of the border in pixels.

## Constructor Details

### DrawBorder

public DrawBorder()
Create a black border that is one pixel thick.

### DrawBorder

public DrawBorder(Color color, int width)
Create a border with the spcified color and width. If the color is null, black is used. If the width is less than zero, a width of 1 is used. A border of width zero is invisible.

## Method Details

### getColor

public Color getColor()
Get the color of the border.

### setColor

public void setColor(Color c)
Set the color of the border to the specified color. If the color is null, nothing is done.

### getWidth

public int getWidth()
Get the width of the border, in pixels.

### setWidth

public void setWidth(int w)
Set the width of the border to be w pixels. If w is negative, this is ignored. A border of witdth 0 is invisible.

Parameters:
  `w` - the desired width for the border.

### draw

public void draw(Graphics g, boolean changed)
Draw the border in the given graphics context. This is not ordinarily called directly.

Specified by:
  `draw` in class `Drawable`
Parameters:
  `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.