Beispiel #1
0
 private void expressComponantFocus() {
   // System.out.println(componants[currentpossition[0]][currentpossition[1]].getXP() + ",,,," +
   // componants[currentpossition[0]][currentpossition[1]].getYP());
   composer.play(componants[currentpossition[0]][currentpossition[1]].getAudioComp().SourceID);
   if (componants[currentpossition[0]][currentpossition[1]].isNeedForcus()) {
     componants[currentpossition[0]][currentpossition[1]].setFocus();
   } else {
   }
 }
Beispiel #2
0
 public void add(AudioComponant componant, int row, int colomn) throws Exception {
   if (this.FrameBasicRiquirement != BFrame.FRAMEREQUIREMENT_READY) {
     throw new Exception("Frame dimentions are not set");
   }
   if (row > componants.length || colomn > componants[0].length) {
     throw new ArrayIndexOutOfBoundsException("rows or coloms are too large");
   }
   componants[row][colomn] = componant;
   // will this casting work?yes
   // componant.createWave();
   composer.addToSoundSources(componant.getAudioComp());
   this.add((Component) componant);
   if (componant instanceof BButton && ((BButton) componant).travser != null) {
     AudioComponant[][] children = ((BButton) componant).travser.componants;
     for (AudioComponant[] com : children) {
       AudioComponant realcom = com[0];
       composer.addToSoundSources(realcom.getAudioComp());
       this.add((Component) realcom);
     }
   }
 }
Beispiel #3
0
  @Override
  public void setVisible(boolean fa) {
    super.setVisible(fa);
    if (fa) {
      if (Welcome_Speech != null) {
        BLabel b = new BLabel();
        b.audioComp.speakLive(Welcome_Speech);
      }

      composer.loadSoundSources();
    } else {
      alert("please wait");
      leaveResources();
    }
  }
Beispiel #4
0
 public void leaveResources() {
   // composer.cleanAudio();
   composer.killALData();
 }
Beispiel #5
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();
    }
  }