|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlejos.nxt.Button
public class Button
Abstraction for an NXT button. Example:
Button.ENTER.waitForPressAndRelease();
Sound.playTone (1000, 1);
Field Summary | |
---|---|
static Button[] |
BUTTONS
Array containing ENTER, LEFT, RIGHT, ESCAPE, in that order. |
static Button |
ENTER
The Enter button. |
static Button |
ESCAPE
The Escape button. |
static Button |
LEFT
The Left button. |
static Button |
RIGHT
The Right button. |
Method Summary | |
---|---|
void |
addButtonListener(ButtonListener aListener)
Adds a listener of button events. |
void |
callListeners()
Call Button Listeners. |
int |
getId()
Return the ID of the button. |
boolean |
isPressed()
Check if the button is pressed. |
static int |
readButtons()
Low-level API that reads status of buttons. |
void |
waitForPressAndRelease()
Wait until the button is released. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait |
Field Detail |
---|
public static final Button ENTER
public static final Button LEFT
public static final Button RIGHT
public static final Button ESCAPE
public static final Button[] BUTTONS
Method Detail |
---|
public final int getId()
public final boolean isPressed()
true
if button is pressed, false
otherwise.public final void waitForPressAndRelease() throws InterruptedException
InterruptedException
public void addButtonListener(ButtonListener aListener)
public static int readButtons()
public void callListeners()
callListeners
in interface ListenerCaller
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |