Package lejos.nxt

Examples of lejos.nxt.ButtonListener


  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();
View Full Code Here


  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();
View Full Code Here

TOP

Related Classes of lejos.nxt.ButtonListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.