コード例 #1
0
  /**
   * Create a new instance of LearnController, let the view set up the data, show all the phrases.
   * Initially the view is visible.
   *
   * @param lesson
   */
  public LearnController(Lesson lesson) {
    selectedLesson = lesson;
    view = LearnFrame.getLearnFrame();
    view.clearAllPhraseItem();

    initAllPhrases();
    addAllListener();

    view.setVisible(true);
  }
コード例 #2
0
  /** Add some listeners to the view */
  private void addAllListener() {

    // finish listener
    view.getFinishButton()
        .addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                MainController main = MainController.getMainController();
                main.getLessonController().initAllPhrases();
                main.setVisible(true);

                view.setVisible(false);
                view.dispose();
                selectedLesson = null;
              }
            });

    // when exiting, back to main frame
    view.addExitingReturnToMainController();
  }
コード例 #3
0
 /** show all the phrase in the view */
 private void initAllPhrases() {
   for (Phrase p : selectedLesson.getAllPhrases()) {
     view.addPhraseItem(p);
   }
 }