org.moyoman.client.reference
Class Annotation

java.lang.Object
  |
  +--org.moyoman.client.reference.Annotation

public class Annotation
extends Object

Provides an annotation object for use with Board.

Since:
v0.01
Version:
v0.17
Author:
Jeffrey M. Thompson

Field Summary
private  Color _background
          Background color.
private  int _border
          Border width (top, left, bottom, and right are this same value).
private  Rectangle _bounds
          Bounds.
private  Point _center
          Center coordinates.
private  Properties _clientProperties
          Client properties.
private  Color _ellipseColor
          Ellipse color.
private  Font _font
          Font.
private  Color _foreground
          Foreground color.
private  boolean _isEllipseVisible
          Flag indicating whether to draw the ellipse.
private  String _text
          Text to display.
private  Point _textOrigin
          Coordinates to draw the text string.
 
Constructor Summary
Annotation()
           
 
Method Summary
 void appendText(String text)
          Append to the text displayed by this component.
 void clear()
          Clear this annotation.
protected  void computeBounds(Graphics g)
          Compute the bounds based upon the center, the font, and the text.
protected  int divisibleByTwo(int value)
          Possibly modify the given value so that it is evenly divisible by two.
 Object getClientProperty(Object key)
          Returns the value of the property with the specified key.
 boolean isVisible()
          Return true if this annotation is visible.
 void paint(Graphics2D g)
          Paint this component onto the given graphics.
 void putClientProperty(Object key, Object value)
          Adds an arbitrary key/value "client property" to this component.
 void setBackground(Color color)
          Set the background color.
 void setCenter(int x, int y)
          Set the center location.
 void setEllipseColor(Color color)
          Set the ellipse color.
 void setEllipseVisible(boolean isVisible)
          Set the visibility of the ellipse.
 void setFont(Font font)
          Set the font.
 void setForeground(Color color)
          Set the foreground color.
 void setText(String text)
          Set the text displayed by this component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_background

private Color _background
Background color.


_ellipseColor

private Color _ellipseColor
Ellipse color.


_foreground

private Color _foreground
Foreground color.


_font

private Font _font
Font.


_center

private Point _center
Center coordinates.


_textOrigin

private Point _textOrigin
Coordinates to draw the text string.


_clientProperties

private Properties _clientProperties
Client properties.


_bounds

private Rectangle _bounds
Bounds.


_text

private String _text
Text to display.


_isEllipseVisible

private boolean _isEllipseVisible
Flag indicating whether to draw the ellipse.


_border

private int _border
Border width (top, left, bottom, and right are this same value).

Constructor Detail

Annotation

public Annotation()
Method Detail

getClientProperty

public final Object getClientProperty(Object key)
Returns the value of the property with the specified key.

Since:
v0.17

putClientProperty

public final void putClientProperty(Object key,
                                    Object value)
Adds an arbitrary key/value "client property" to this component.

Since:
v0.17

setBackground

public void setBackground(Color color)
Set the background color.

Since:
v0.01

setCenter

public void setCenter(int x,
                      int y)
Set the center location.

Since:
v0.14

setEllipseColor

public void setEllipseColor(Color color)
Set the ellipse color.

Since:
v0.01

setEllipseVisible

public void setEllipseVisible(boolean isVisible)
Set the visibility of the ellipse.

Since:
v0.01

setFont

public void setFont(Font font)
Set the font.

Since:
v0.01

setForeground

public void setForeground(Color color)
Set the foreground color.

Since:
v0.01

setText

public void setText(String text)
Set the text displayed by this component.

Since:
v0.01

isVisible

public boolean isVisible()
Return true if this annotation is visible.

Since:
v0.14

appendText

public void appendText(String text)
Append to the text displayed by this component.

Since:
v0.14

clear

public void clear()
Clear this annotation.

Since:
v0.14

paint

public void paint(Graphics2D g)
Paint this component onto the given graphics.

Since:
v0.01

computeBounds

protected void computeBounds(Graphics g)
Compute the bounds based upon the center, the font, and the text.

Since:
v0.01

divisibleByTwo

protected int divisibleByTwo(int value)
Possibly modify the given value so that it is evenly divisible by two.

Returns:
the value or the value plus one, whichever is divisible by two.
Since:
v0.01