com.bluemarsh.jswat.view
Class BasicDrawContext

java.lang.Object
  |
  +--com.bluemarsh.jswat.view.BasicDrawContext
All Implemented Interfaces:
DrawContext

public class BasicDrawContext
extends java.lang.Object
implements DrawContext

This class implements methods for getting and setting various drawing attributes.

Author:
Nathan Fiedler

Field Summary
protected  java.awt.Color backColor
          Background color.
protected  java.awt.Color defaultBackColor
          Default background color.
protected  java.awt.Font defaultFont
          Default font.
protected  java.awt.Color defaultForeColor
          Default foreground color.
protected  java.awt.Font font
          Font.
protected  java.awt.Color foreColor
          Foreground color.
 
Constructor Summary
BasicDrawContext(java.awt.Color fore, java.awt.Color back, java.awt.Font font)
          Creates a BasicDrawContext with the given default properties.
 
Method Summary
 java.awt.Color getBackColor()
          Get current background color.
 java.awt.Font getFont()
          Get current font.
 java.awt.Color getForeColor()
          Get current foreground color.
 void reset()
          Reset back to the default color and font properties.
 void setBackColor(java.awt.Color color)
          Set current background color.
 void setFont(java.awt.Font font)
          Set current font.
 void setForeColor(java.awt.Color color)
          Set current foreground color.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultBackColor

protected java.awt.Color defaultBackColor
Default background color.

defaultForeColor

protected java.awt.Color defaultForeColor
Default foreground color.

defaultFont

protected java.awt.Font defaultFont
Default font.

backColor

protected java.awt.Color backColor
Background color.

foreColor

protected java.awt.Color foreColor
Foreground color.

font

protected java.awt.Font font
Font.
Constructor Detail

BasicDrawContext

public BasicDrawContext(java.awt.Color fore,
                        java.awt.Color back,
                        java.awt.Font font)
Creates a BasicDrawContext with the given default properties. When the reset() method is called, these defaults are used.
Parameters:
fore - foreground color default.
back - background color default.
font - font default.
Method Detail

getBackColor

public java.awt.Color getBackColor()
Get current background color.
Specified by:
getBackColor in interface DrawContext
Returns:
background color.

getFont

public java.awt.Font getFont()
Get current font.
Specified by:
getFont in interface DrawContext
Returns:
font.

getForeColor

public java.awt.Color getForeColor()
Get current foreground color.
Specified by:
getForeColor in interface DrawContext
Returns:
foreground color.

reset

public void reset()
Reset back to the default color and font properties.

setBackColor

public void setBackColor(java.awt.Color color)
Set current background color.
Specified by:
setBackColor in interface DrawContext
Parameters:
color - background color.

setForeColor

public void setForeColor(java.awt.Color color)
Set current foreground color.
Specified by:
setForeColor in interface DrawContext
Parameters:
color - foreground color.

setFont

public void setFont(java.awt.Font font)
Set current font.
Specified by:
setFont in interface DrawContext
Parameters:
font - new font.