de.htwdd.rosenkoenig.gui.genuts
Class Counter

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

public class Counter
extends java.lang.Object

This class holds the GUI representation of a counter. The counter consists of two rows, the first row is able to show up to four digits, while the second row is able to show up to three smaller digits with a "+" in front. The first row of digits is called "score", the second row is called "increase".


Field Summary
private  ImageSequenceSprite[] digits
           
private  ImageSequenceSprite[] digitsChange
           
private static int DIST
           
private  org.apache.log4j.Logger log
           
private  Position position
           
private  ImageSequenceSprite sign
           
 
Constructor Summary
Counter(PlayField playfield)
          Creates the different sprites needed to represent the digits and adds them to the playfield.
 
Method Summary
 int getHeight()
           
 int getWidth()
           
 void hideChange()
          hides the increase (digits and "+")
 void setChange(int change)
          updates and shows the counter's increase.
 void setPosition(Position position)
           
 void setScore(int score)
          updates the counter's score.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIST

private static final int DIST
See Also:
Constant Field Values

log

private org.apache.log4j.Logger log

digits

private ImageSequenceSprite[] digits

digitsChange

private ImageSequenceSprite[] digitsChange

sign

private ImageSequenceSprite sign

position

private Position position
Constructor Detail

Counter

public Counter(PlayField playfield)
Creates the different sprites needed to represent the digits and adds them to the playfield. The score is set to 0 and the increase is hidden.

Parameters:
playfield - the playfield that contains the counter
Method Detail

setScore

public void setScore(int score)
updates the counter's score.

Parameters:
score - 0 <= score <= 9999

setChange

public void setChange(int change)
updates and shows the counter's increase.

Parameters:
change - 0 <= increase <= 999

hideChange

public void hideChange()
hides the increase (digits and "+")


getHeight

public int getHeight()

getWidth

public int getWidth()

setPosition

public void setPosition(Position position)
Parameters:
position - the position to set