lejos.util
Class ButtonCounter

java.lang.Object
  extended by lejos.util.ButtonCounter

public class ButtonCounter
extends Object

This is class is for data entry using the NXT keyboard. Counts number of presses of left and right buttons
Press ENTER together with together with LEFT or RIGHT to decrease the count. Press ESCAPE to end counting. Displays the count as it is entered, and makes a sound with each button press. Stores the count in public fields

Author:
Roger Glassey 8/20/07

Field Summary
 int _leftCount
          Output only not used in calculations; use after count() returns;
 int _rightCount
          Output only not used in calculations ; use this value after count() returns;
 
Constructor Summary
ButtonCounter()
           
 
Method Summary
 void count()
          called by count( string)
 void count(String s)
          Start counting; parameter string is displayed; use it to identify this particular call
returns when ESC or ENTER button is pressed
Hold Enter and left or right to decrease count, otherwise it increases
counters are reset when this method is called.
 void count(String s, int left, int right)
          Initializes values of left count and right count.
 int getLeftCount()
          Use this method after counting is complete;
 int getRightCount()
          Use this method after counting is complete;
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_rightCount

public int _rightCount
Output only not used in calculations ; use this value after count() returns;


_leftCount

public int _leftCount
Output only not used in calculations; use after count() returns;

Constructor Detail

ButtonCounter

public ButtonCounter()
Method Detail

getRightCount

public int getRightCount()
Use this method after counting is complete;

Returns:
value of right count.

getLeftCount

public int getLeftCount()
Use this method after counting is complete;

Returns:
value of left count.

count

public void count(String s)
Start counting; parameter string is displayed; use it to identify this particular call
returns when ESC or ENTER button is pressed
Hold Enter and left or right to decrease count, otherwise it increases
counters are reset when this method is called.


count

public void count()
called by count( string)


count

public void count(String s,
                  int left,
                  int right)
Initializes values of left count and right count. Displays parameter s ; sets _leftcount = left, _rightCount = right