示例#1
0
 /** @param args the command line arguments */
 public static void main(String[] args) throws Exception {
   ASystem.systemPositional(true);
   ASystem.setIsLinear(false);
   Login l = new Login();
   l.Welcome_Speech = "welcome to login";
   l.setVisible(true);
   BLog.writeLog("Start");
 }
示例#2
0
  public void keyPressed(KeyEvent e) {
    // System.out.println("key");
    if (!ASystem.isIsLinear()) {
      // if the arrow keys make it positional
      if (KeyEvent.VK_LEFT == e.getKeyCode()) {
        // System.out.println("left");
        if (currentpossition[1] > 0) {
          currentpossition[1]--;
          expressComponant();
        } else {

          composer.playRandomPositioned(
              getCurrentComponant().getXP() - 1, getCurrentComponant().getYP());
        }
      } else if (KeyEvent.VK_RIGHT == e.getKeyCode()) {
        // System.out.println("right");
        if (currentpossition[1] < componants[0].length - 1) {
          currentpossition[1]++;
          expressComponant();
        } else {
          composer.playRandomPositioned(
              getCurrentComponant().getXP() + 1, getCurrentComponant().getYP());
        }
      } else if (KeyEvent.VK_DOWN == e.getKeyCode()) {
        if (currentpossition[0] > 0) {
          currentpossition[0]--;
          expressComponant();
        } else {
          composer.playRandomPositioned(
              getCurrentComponant().getXP(), getCurrentComponant().getYP() - 1);
        }
      } else if (KeyEvent.VK_UP == e.getKeyCode()) {
        if (currentpossition[0] < componants.length - 1) {
          currentpossition[0]++;
          expressComponant();
        } else {
          composer.playRandomPositioned(
              getCurrentComponant().getXP(), getCurrentComponant().getYP() + 1);
        }
      }
    } else {
      // if its liners the top and bottom arrow keys should work.

      if (KeyEvent.VK_DOWN == e.getKeyCode()) {
        if (currentpossition[1] < componants[0].length - 1) {
          currentpossition[1]++;
          expressComponant();
        } else {
          if (currentpossition[0] < componants.length - 1) {
            currentpossition[1] = 0;
            currentpossition[0]++;
            expressComponant();
          } else {
            composer.playRandomPositioned(
                getCurrentComponant().getXP(), getCurrentComponant().getYP() + 1);
            // System.out.println("out of bound");
          }
        }
        // System.out.println(currentpossition[0] + "-" + currentpossition[1] + "|||");

      } else if (KeyEvent.VK_UP == e.getKeyCode()) {

        if (currentpossition[1] > 0) {
          currentpossition[1]--;
          expressComponant();
        } else {
          if (currentpossition[0] > 0) {
            currentpossition[1] = componants[0].length - 1;
            currentpossition[0]--;
            expressComponant();
          } else {
            composer.playRandomPositioned(
                getCurrentComponant().getXP(), getCurrentComponant().getYP() + 1);
          }
        }

        // System.out.println(currentpossition[0] + "-" + currentpossition[1] + "|||");

      }
    }
    if (KeyEvent.VK_ENTER == e.getKeyCode()) {
      doEnter();

    } else if (KeyEvent.VK_ESCAPE == e.getKeyCode()) {
      doEscape();
    } else if (KeyEvent.VK_F1 == e.getKeyCode()) {
      glipseForm();

    } else if (KeyEvent.VK_F2 == e.getKeyCode()) {
      // System.out.println("Enter context");
      alert("please select an option");
      doContext();
    } else if (KeyEvent.VK_HOME == e.getKeyCode()) {
      doHome();
    } else if (KeyEvent.VK_F3 == e.getKeyCode()) {
      expressComponantFocus();
    } else if (KeyEvent.VK_CONTROL == e.getKeyCode()) {
      interuptGlimpse();
    }
  }