jcurzez
Class Pen

java.lang.Object
  |
  +--jcurzez.Pen
Direct Known Subclasses:
FillingPen

public class Pen
extends java.lang.Object

A Pen contains three attributes:

Version:
0.0.3
Author:
Thomas Girard

Field Summary
protected  Attribute attribute
          Attribute for this Pen.
protected  BackgroundColor background
          Background color for this Pen.
protected  ForegroundColor foreground
          Foreground color for this Pen.
 
Constructor Summary
Pen()
          Creates a new pen with defaults values for foreground color, background color and attribute.
Pen(ForegroundColor foreground, BackgroundColor background, Attribute attribute)
          Creates a new pen with specified foreground, background and attribute.
 
Method Summary
 boolean equals(java.lang.Object o)
          Checks whether this is equal to o.
 Attribute getAttribute()
          Retrieves the attribute of this pen.
 BackgroundColor getBackgroundColor()
          Retrieves the background color.
 ForegroundColor getForegroundColor()
          Retrieves the foreground color.
 void setAttribute(Attribute attribute)
          Changes the attribute.
 void setBackgroundColor(BackgroundColor background)
          Changes the background color.
 void setForegroundColor(ForegroundColor foreground)
          Changes the foreground color.
 java.lang.String toString()
          Returns a string representation of this.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

foreground

protected ForegroundColor foreground
Foreground color for this Pen.


background

protected BackgroundColor background
Background color for this Pen.


attribute

protected Attribute attribute
Attribute for this Pen.

Constructor Detail

Pen

public Pen()
Creates a new pen with defaults values for foreground color, background color and attribute.


Pen

public Pen(ForegroundColor foreground,
           BackgroundColor background,
           Attribute attribute)
Creates a new pen with specified foreground, background and attribute.

Parameters:
foreground - the foreground color.
background - the background color.
attribute - the attribute fro this pen.
Method Detail

equals

public boolean equals(java.lang.Object o)
Checks whether this is equal to o.

Overrides:
equals in class java.lang.Object
Parameters:
o - the object to compare this with.
Returns:
true if this is equal to o.

setBackgroundColor

public void setBackgroundColor(BackgroundColor background)
Changes the background color.

Parameters:
background - the new background color.

setForegroundColor

public void setForegroundColor(ForegroundColor foreground)
Changes the foreground color.

Parameters:
foreground - the new foreground color.

setAttribute

public void setAttribute(Attribute attribute)
Changes the attribute.

Parameters:
attribute - the new attribute.

getForegroundColor

public ForegroundColor getForegroundColor()
Retrieves the foreground color.

Returns:
the foreground color.

getBackgroundColor

public BackgroundColor getBackgroundColor()
Retrieves the background color.

Returns:
the background color.

getAttribute

public Attribute getAttribute()
Retrieves the attribute of this pen.

Returns:
the attribute of this pen.

toString

public java.lang.String toString()
Returns a string representation of this. It has the form [ _foreground_ on _background_ with _attribute_ ].

Overrides:
toString in class java.lang.Object
Returns:
the string representation of this.


Send me an email