public AnagramTopComponent() {
   wordLibrary = WordLibrary.getDefault();
   initComponents();
   scrambledWord.setText(wordLibrary.getScrambledWord(wordIdx));
   setName(NbBundle.getMessage(AnagramTopComponent.class, "CTL_AnagramTopComponent"));
   setToolTipText(NbBundle.getMessage(AnagramTopComponent.class, "HINT_AnagramTopComponent"));
 }
Example #2
0
  private void nextTrialActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_nextTrialActionPerformed
    wordIdx = (wordIdx + 1) % wordLibrary.getSize();

    feedbackLabel.setText(" ");
    scrambledWord.setText(wordLibrary.getScrambledWord(wordIdx));
    guessedWord.setText("");
    getRootPane().setDefaultButton(guessButton);

    guessedWord.requestFocusInWindow();
  } // GEN-LAST:event_nextTrialActionPerformed
Example #3
0
  /** Creates new form Anagrams */
  public Anagrams() {
    wordLibrary = WordLibrary.getDefault();

    initComponents();
    getRootPane().setDefaultButton(guessButton);
    scrambledWord.setText(wordLibrary.getScrambledWord(wordIdx));
    pack();
    guessedWord.requestFocusInWindow();
    // Center in the screen
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension frameSize = getSize();
    setLocation(
        new Point(
            (screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.width) / 2));
  }