public void quit() {
quit = true;
}
private void showUsingListeners() {
Button.ENTER.addButtonListener(new ButtonListener() {
public void buttonReleased (Button b) {}
public void buttonPressed (Button b) {
if (current != null) {
if (current instanceof Alert) {
// Hide alert screen and replace backup without notify
Screen saved = current;
current.keyPressed(Displayable.KEY_ENTER);
// Make sure that we are still current!
if (saved == current)
{
current.hideNotify();
current = alertBackup;
alertBackup = null;
}
} else {
current.keyPressed(Displayable.KEY_ENTER);
}
update();
}
}
});
Button.ESCAPE.addButtonListener(new ButtonListener() {
public void buttonReleased (Button b) {}
public void buttonPressed (Button b) {
if (current != null) {
current.keyPressed(Displayable.KEY_BACK);
update();
}
}
});
Button.LEFT.addButtonListener(new ButtonListener() {
public void buttonReleased (Button b) {}
public void buttonPressed (Button b) {
if (current != null) {
current.keyPressed(Displayable.KEY_LEFT);
update();
}
}
});
Button.RIGHT.addButtonListener(new ButtonListener() {
public void buttonReleased (Button b) {}
public void buttonPressed (Button b) {
if (current != null) {
current.keyPressed(Displayable.KEY_RIGHT);
update();