예제 #1
0
 private void setimagefolderButtonActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_setimagefolderButtonActionPerformed
   // TODO add your handling code here:
   if (stopButton.isEnabled() == true) {
     javax.swing.JOptionPane.showMessageDialog(
         null,
         "Please stop the camera before you set image folder",
         "Action not allowed",
         javax.swing.JOptionPane.INFORMATION_MESSAGE);
   } else {
     im.run();
   }
 } // GEN-LAST:event_setimagefolderButtonActionPerformed
예제 #2
0
  public void first() {
    // System.out.println("Inside First. This is called only once");
    java.util.Scanner s = null;

    try {
      s = new java.util.Scanner(new java.io.BufferedReader(new java.io.FileReader("sample")));
      s.useLocale(java.util.Locale.US);
      position = 0;
      while (s.hasNext()) {
        if (s.hasNextLine()) {
          String c = s.nextLine();
          ch[position] = c.charAt(0);
          for (int i = 0; i < 35; i++) {
            Character cha = new Character(c.charAt(i + 1));
            String st = cha.toString();
            data[position][i] = Integer.parseInt(st);
          }
          position++;
        }
      }
    } catch (java.io.IOException ert) {
      javax.swing.JOptionPane.showMessageDialog(
          null, ert, "Error", javax.swing.JOptionPane.ERROR_MESSAGE);
    }

    try {
      s = new java.util.Scanner(new java.io.BufferedReader(new java.io.FileReader("imageload")));
      s.useLocale(java.util.Locale.US);
      while (s.hasNext()) {
        if (s.hasNextLine()) {
          imagedir = s.nextLine();
        }
      }
    } catch (java.io.IOException ert) {
      javax.swing.JOptionPane.showMessageDialog(
          null, ert, "Error", javax.swing.JOptionPane.ERROR_MESSAGE);
    }
    s.close();
    if (imagedir.equals("")) {
      javax.swing.JOptionPane.showMessageDialog(
          null,
          "This must be your first run of Live! Character Recognition.\nPlease set an image folder.",
          "Problem loading image",
          javax.swing.JOptionPane.INFORMATION_MESSAGE);
    } else {
      im.running();
    }
  }