コード例 #1
0
ファイル: ClippyGui.java プロジェクト: teihoata/Clippy
 /** 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());
   }
 }
コード例 #2
0
ファイル: ClippyGui.java プロジェクト: teihoata/Clippy
  /**
   * 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);
  }
コード例 #3
0
ファイル: ClippyGui.java プロジェクト: teihoata/Clippy
 /**
  * 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);
 }
コード例 #4
0
ファイル: ClippyGui.java プロジェクト: teihoata/Clippy
 /**
  * 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);
 }
コード例 #5
0
ファイル: ClippyGui.java プロジェクト: teihoata/Clippy
 /**
  * Updates the voice menu header
  *
  * @param update the header
  */
 public void setHeader(String update) {
   voiceMenu.setHeaderUpdate(update);
 }