VASSAL.counters
Class Labeler

java.lang.Object
  |
  +--VASSAL.counters.Decorator
        |
        +--VASSAL.counters.Labeler
All Implemented Interfaces:
EditablePiece, GamePiece

public class Labeler
extends Decorator
implements EditablePiece

Displays a text label, with content specified by the user at runtime


Field Summary
static int BOTTOM
           
static int CENTER
           
static int HORIZONTAL_ALIGNMENT
           
static java.lang.String ID
           
static int LEFT
           
static int RIGHT
           
protected  java.awt.Color textBg
           
protected  java.awt.Color textFg
           
static int TOP
           
static int VERTICAL_ALIGNMENT
           
 
Constructor Summary
Labeler()
           
Labeler(java.lang.String s, GamePiece d)
           
 
Method Summary
 java.awt.Rectangle boundingBox()
          The area which this GamePiece occupies when drawn at the point given by getPosition().
protected  java.awt.Image createImage(java.awt.Component obs)
           
 void draw(java.awt.Graphics g, int x, int y, java.awt.Component obs, double zoom)
           
static void drawLabel(java.awt.Graphics g, java.lang.String text, int x, int y, java.awt.Font f, int hAlign, int vAlign, java.awt.Color fgColor, java.awt.Color bgColor, java.awt.Color borderColor)
           
static void drawLabel(java.awt.Graphics g, java.lang.String text, int x, int y, int hAlign, int vAlign, java.awt.Color fgColor, java.awt.Color bgColor)
           
 java.lang.String getDescription()
          A plain-English description of this type of piece
 PieceEditor getEditor()
          Get the configurer for this trait
 HelpFile getHelpFile()
           
 java.lang.String getLabel()
           
 java.lang.String getName()
          The plain English name for this piece
 KeyCommand[] myGetKeyCommands()
           
 java.lang.String myGetState()
           
 java.lang.String myGetType()
           
 Command myKeyEvent(javax.swing.KeyStroke stroke)
          The response of this trait alone to the given KeyStroke
 void mySetState(java.lang.String s)
          Set just the state of this trait
 void mySetType(java.lang.String type)
          Set the type information for this piece.
 java.awt.Rectangle selectionBounds()
          The area which is considered part of this GamePiece for purposes of selecting it with the mouse
 void setBackground(java.awt.Color textBg)
           
 void setForeground(java.awt.Color textFg)
           
 void setLabel(java.lang.String s)
           
 
Methods inherited from class VASSAL.counters.Decorator
getDecorator, getId, getInner, getInnermost, getKeyCommands, getMap, getOutermost, getParent, getPosition, getProperty, getState, getType, keyEvent, mergeState, setId, setInner, setMap, setParent, setPosition, setProperty, setState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface VASSAL.counters.GamePiece
getId, getMap, getParent, getPosition, getProperty, getState, getType, keyEvent, setId, setMap, setParent, setPosition, setProperty, setState
 

Field Detail

ID

public static final java.lang.String ID
See Also:
Constant Field Values

textBg

protected java.awt.Color textBg

textFg

protected java.awt.Color textFg

CENTER

public static final int CENTER
See Also:
Constant Field Values

RIGHT

public static final int RIGHT
See Also:
Constant Field Values

LEFT

public static final int LEFT
See Also:
Constant Field Values

TOP

public static final int TOP
See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
See Also:
Constant Field Values

HORIZONTAL_ALIGNMENT

public static int HORIZONTAL_ALIGNMENT

VERTICAL_ALIGNMENT

public static int VERTICAL_ALIGNMENT
Constructor Detail

Labeler

public Labeler()

Labeler

public Labeler(java.lang.String s,
               GamePiece d)
Method Detail

mySetType

public void mySetType(java.lang.String type)
Description copied from interface: EditablePiece
Set the type information for this piece. See Decorator.myGetType()

Specified by:
mySetType in interface EditablePiece

myGetType

public java.lang.String myGetType()
Specified by:
myGetType in class Decorator
Returns:
the type of this trait alone
See Also:
Decorator.getType()

myGetState

public java.lang.String myGetState()
Specified by:
myGetState in class Decorator
Returns:
the state of this trait alone
See Also:
Decorator.getState()

mySetState

public void mySetState(java.lang.String s)
Description copied from class: Decorator
Set just the state of this trait

Specified by:
mySetState in class Decorator
See Also:
Decorator.myGetState()

getName

public java.lang.String getName()
Description copied from interface: GamePiece
The plain English name for this piece

Specified by:
getName in interface GamePiece

drawLabel

public static void drawLabel(java.awt.Graphics g,
                             java.lang.String text,
                             int x,
                             int y,
                             int hAlign,
                             int vAlign,
                             java.awt.Color fgColor,
                             java.awt.Color bgColor)

drawLabel

public static void drawLabel(java.awt.Graphics g,
                             java.lang.String text,
                             int x,
                             int y,
                             java.awt.Font f,
                             int hAlign,
                             int vAlign,
                             java.awt.Color fgColor,
                             java.awt.Color bgColor,
                             java.awt.Color borderColor)

draw

public void draw(java.awt.Graphics g,
                 int x,
                 int y,
                 java.awt.Component obs,
                 double zoom)
Specified by:
draw in interface GamePiece

setLabel

public void setLabel(java.lang.String s)

setBackground

public void setBackground(java.awt.Color textBg)

setForeground

public void setForeground(java.awt.Color textFg)

createImage

protected java.awt.Image createImage(java.awt.Component obs)

getLabel

public java.lang.String getLabel()

boundingBox

public java.awt.Rectangle boundingBox()
Description copied from interface: GamePiece
The area which this GamePiece occupies when drawn at the point given by getPosition().

Specified by:
boundingBox in interface GamePiece

selectionBounds

public java.awt.Rectangle selectionBounds()
Description copied from interface: GamePiece
The area which is considered part of this GamePiece for purposes of selecting it with the mouse

Specified by:
selectionBounds in interface GamePiece

myGetKeyCommands

public KeyCommand[] myGetKeyCommands()
Specified by:
myGetKeyCommands in class Decorator
Returns:
the commands for this trait alone
See Also:
Decorator.getKeyCommands()

myKeyEvent

public Command myKeyEvent(javax.swing.KeyStroke stroke)
Description copied from class: Decorator
The response of this trait alone to the given KeyStroke

Specified by:
myKeyEvent in class Decorator
Parameters:
stroke -
Returns:
null if no effect
See Also:
Decorator.keyEvent(javax.swing.KeyStroke)

getDescription

public java.lang.String getDescription()
Description copied from interface: EditablePiece
A plain-English description of this type of piece

Specified by:
getDescription in interface EditablePiece

getHelpFile

public HelpFile getHelpFile()
Specified by:
getHelpFile in interface EditablePiece

getEditor

public PieceEditor getEditor()
Description copied from interface: EditablePiece
Get the configurer for this trait

Specified by:
getEditor in interface EditablePiece
Overrides:
getEditor in class Decorator