コード例 #1
0
  private void saveFile(File file) {
    try {
      BufferedWriter writer = new BufferedWriter(new FileWriter(file));

      for (QuizCard card : cardList) {
        writer.write(card.getQuestion() + "/");
        writer.write(card.getAnswer() + "/n");
      }
    } catch (IOException ex) {
      System.out.println("Couldn't wirite the cardList out");
      ex.printStackTrace();
    }
  }
コード例 #2
0
 private void showNextCard() {
   currentCard = cardList.get(currentCardIndex);
   currentCardIndex++;
   display.setText(currentCard.getQuestion());
   nextButton.setText("Show Answer");
   isShowAnswer = true;
 }