public void testYourselfProgress() {
   // Goes through the list from the last unmemorized word in the word list, testing a character on
   // characters,
   // pinyin and definition.
   if (choice == correct) {
     JOptionPane.showMessageDialog(null, "Correct!");
     if (current < wordIndex) { // Error check to see whether the quiz has reached the final word.
       // Goes through each word, testing the pinyin, character and the definition.
       if (progress % 3 == 0) {
         pinyinLoad();
         progress++;
       } else if (progress % 3 == 1) {
         characterLoad();
         progress++;
       } else if (progress % 3 == 2) {
         definitionLoad();
         progress++;
         // User has memorized the word
         words[current].setMemorized(true);
         current++; // Increments up to test the user on the new word.
       }
     } else {
       // If the test has gone on to the final word, closes the form and goes back to the main
       // form.
       saveWords();
       MainWindow start = new MainWindow();
       start.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       start.setVisible(true);
       this.dispose();
     }
   } else {
     JOptionPane.showMessageDialog(null, "Sorry, you got it wrong.");
   }
 }
 private void jButton1ActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton1ActionPerformed
   // Closes this window and restarts the main window.
   MainWindow start = new MainWindow();
   start.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   start.setVisible(true);
   saveWords();
   this.dispose();
 } // GEN-LAST:event_jButton1ActionPerformed
 /** @param args the command line arguments */
 public void memorizeListProgress() {
   // Tests users on a character based on either characters, definition or pinyin.
   current++;
   if (choice == correct) {
     JOptionPane.showMessageDialog(null, "Correct!");
     if (current < wordIndex) { // Error check to see whether the quiz has reached the final word.
       loadLists(); // Random process, tests based on characters definition or pinyin.
     } else {
       MainWindow start = new MainWindow();
       start.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       start.setVisible(true);
       this.dispose();
     }
   } else {
     JOptionPane.showMessageDialog(null, "Sorry, you got it wrong.");
   }
 }
Example #4
0
  public static void main(String[] args) {

    if (args.length != 1) {
      System.out.println("Usage: java Msp <filename>");
      System.exit(2);
    }
    Graph g = new Graph();
    loadFile(g, args[0]);

    // Calculate locations of nodes
    g.prepareNodes();
    // Perform kruskal algorithm
    g.kruskal();

    // Show results in JFrame
    MainWindow f = new MainWindow(g);
    f.setSize(800, 600);
    f.setVisible(true);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }