Exemplo n.º 1
0
 /** Creates a panel for the components of the interface */
 private void createPnl() throws InterruptedException {
   clipPnl = new JPanel();
   setPnl(lpane);
   setImage();
   setSpeechImg();
   addBtn();
   addClippyTxt();
   lpane.setOpaque(false);
   voiceMenu = new VoiceMenu(currentBehavior);
   voiceMenu.pack();
   voiceMenu.setVisible(true);
   setExitBtn();
   try {
     setup();
   } catch (IOException ex) {
     System.err.println(ex.getMessage());
   }
 }
Exemplo n.º 2
0
  /**
   * Initializes the Logic classes in the interface
   *
   * @throws IOException
   * @throws InterruptedException
   */
  private void setup() throws IOException, InterruptedException {
    // Get the configuration from the xml resource
    URL url = WordRecognizer.class.getResource("clippy.config.xml");
    ConfigurationManager cm = new ConfigurationManager(url);
    wordsRecognizer = (WordRecognizer) cm.lookup("dialogManager");
    wordsRecognizer.setGui(this);
    MyBehavior menu = new MyBehavior(this);
    MyBehavior time = new MyBehavior(this);
    MyBehavior music = new MyMusicBehavior(this);
    MyBehavior movie = new MyMovieBehavior(this);
    MyBehavior desktop = new MyDesktopBehavior(this);
    MyBehavior website = new MyWebsiteBehavior(this);
    search = new MyGoogleSearchBehavior(this);

    // Add each menu node to the words to be recognised
    wordsRecognizer.addNode("menu", menu);
    wordsRecognizer.addNode("tell me the time", time);
    wordsRecognizer.addNode("music", music);
    wordsRecognizer.addNode("movies", movie);
    wordsRecognizer.addNode("desktop", desktop);
    wordsRecognizer.addNode("web", website);
    wordsRecognizer.addNode("search", search);
    currentBehavior = menu;

    setHeader("Loading IntelliJ");
    initJIntellitype();

    setHeader("Loading Dialogs");
    wordsRecognizer.allocate();

    setHeader("Running  ...");
    wordsRecognizer.addWordListener(
        new WordsListener() {

          public void notify(String word) {
            updateMenu(word);
          }
        });

    wordsRecognizer.setInitialNode("menu");
    voiceMenu.setWordsRecognizer(wordsRecognizer);
  }
Exemplo n.º 3
0
 /**
  * Sets the menu to the current menu
  *
  * @param menu the selected menu
  */
 public void setCurrentMenu(ArrayList menu) {
   javax.swing.Timer timer = new Timer(500, null);
   timer.start();
   voiceMenu.setVoiceMenu(menu);
 }
Exemplo n.º 4
0
 /**
  * Sets and switch to the current behavior
  *
  * @param behav the selected behavior
  */
 public void setCurrentBehavior(MyBehavior behav) {
   currentBehavior = behav;
   exeState = true;
   setClippyTxt("Entering " + currentBehavior.getName());
   voiceMenu.setBehavior(currentBehavior);
 }
Exemplo n.º 5
0
 /**
  * Updates the voice menu header
  *
  * @param update the header
  */
 public void setHeader(String update) {
   voiceMenu.setHeaderUpdate(update);
 }