de.htwdd.rosenkoenig.gui.genuts
Class Name

java.lang.Object
  extended by de.htwdd.rosenkoenig.gui.genuts.Name

public class Name
extends java.lang.Object

This class holds the GUI representation of a String. The Name can consist of up to nine letters.
A Name can have two states: activated and deactivated. Activated names are drawn red, deactivated names black.


Field Summary
private  ImageSequenceSprite[][] letters
           
static int MAX_LETTERS
           
private  Position position
           
private static char[] UMLAUTS
           
 
Constructor Summary
Name(PlayField playfield, java.lang.String playerName)
          Creates the different sprites needed to represent the player's name and adds them to the playfield.
Name(PlayField playfield, java.lang.String playerName, boolean activate)
           
 
Method Summary
 void activate()
          Changes the letter color to red.
 void deactivate()
          Changes the letter color to black.
 int getCharHeight()
           
 int getCharWidth()
           
 int getHeight()
           
 int getWidth()
           
private  void placeLetters()
          Places the single letters this Name consists of.
private  void setName(java.lang.String playerName)
          Changes the string this Name represents.
 void setPosition(Position position)
          Positions the letters of this Name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_LETTERS

public static final int MAX_LETTERS
See Also:
Constant Field Values

UMLAUTS

private static final char[] UMLAUTS

letters

private ImageSequenceSprite[][] letters

position

private Position position
Constructor Detail

Name

public Name(PlayField playfield,
            java.lang.String playerName,
            boolean activate)
     throws java.lang.Exception
Throws:
java.lang.Exception

Name

public Name(PlayField playfield,
            java.lang.String playerName)
     throws java.lang.Exception
Creates the different sprites needed to represent the player's name and adds them to the playfield.

Parameters:
playfield - the playfield that contains the Name
playerName - take a guess!
Throws:
java.lang.Exception
Method Detail

setName

private void setName(java.lang.String playerName)
Changes the string this Name represents.

Parameters:
playerName - Obermops

placeLetters

private void placeLetters()
Places the single letters this Name consists of.


getHeight

public int getHeight()

getWidth

public int getWidth()

getCharHeight

public int getCharHeight()

getCharWidth

public int getCharWidth()

activate

public void activate()
Changes the letter color to red.


deactivate

public void deactivate()
Changes the letter color to black.


setPosition

public void setPosition(Position position)
Positions the letters of this Name.

Parameters:
position - the position to set