@Override
  public void actionPerformed(ActionEvent AE) {
    if (AE.getSource() == CheckAll) {
      boolean Selection = CheckAll.isSelected();
      if (Selection) CheckAll.setText("Uncheck all");
      else CheckAll.setText("Check all");
      for (int i = 0; i < NumberOfCourses; i++) My[i].CourseCheckBox.setSelected(Selection);
    }

    if (AE.getSource() == DocButton)
      if (TempControll.ConnectionManagerObject.createConnection()) {

        new File(System.getProperty("user.home") + "/TermResultCalculator/StudentDocs/").mkdirs();
        if (gatherDataForDocument()) {
          if (TempControll.StudentPdfObject.createPDF(
              this.Roll, this.Session, this.Selected, this.Taken, this.Completed, this.GPA))
            JOptionPane.showMessageDialog(
                RPS,
                "Report created successfully at "
                    + System.getProperty("user.home")
                    + "/TermResultCalculator/StudentDocs/",
                "Success",
                JOptionPane.INFORMATION_MESSAGE);
          else
            JOptionPane.showMessageDialog(
                RPS, "Error while creating report.", "Error", JOptionPane.ERROR_MESSAGE);
        } else
          JOptionPane.showMessageDialog(
              RPS,
              "At least one course has to be selected.",
              "Error : No Selection",
              JOptionPane.ERROR_MESSAGE);
      }
  }
示例#2
0
  public void JudgeWhoIsWinner() // 判断胜负
      {
    String winner = "";

    if (white == 0) {
      JOptionPane.showMessageDialog(null, "黑方胜!" + black + ":" + white);
      //			JOptionPane.showMessageDialog(null, "游戏结束!用时" + time + "秒");
      submit.setEnabled(false);
      winner = "黑";
    }
    if (black == 0) {
      JOptionPane.showMessageDialog(null, "白方胜!" + white + ":" + black);
      //			JOptionPane.showMessageDialog(null, "游戏结束!用时" + time + "秒");
      submit.setEnabled(false);
      winner = "白";
    }
    if (black + white == 64) {
      if (white > black) {
        JOptionPane.showMessageDialog(null, "白方胜!" + white + ":" + black);
        //				JOptionPane.showMessageDialog(null, "游戏结束!用时" + time + "秒");
        submit.setEnabled(false);
        winner = "白";
      } else if (black > white) {
        JOptionPane.showMessageDialog(null, "黑方胜!" + black + ":" + white);
        //				JOptionPane.showMessageDialog(null, "游戏结束!用时" + time + "秒");
        submit.setEnabled(false);
        winner = "白";
      } else if (black == white) {
        JOptionPane.showMessageDialog(null, "和局!");
        //				JOptionPane.showMessageDialog(null, "游戏结束!用时" + time + "秒");
        winner = "";
      }
    }
  }
示例#3
0
 public void actionPerformed(ActionEvent e) {
   JFileChooser chooser = new JFileChooser();
   chooser.setDialogTitle("Load");
   int choice = 0;
   do {
     int result = chooser.showOpenDialog(null);
     if (result == JFileChooser.APPROVE_OPTION) {
       file = chooser.getSelectedFile();
       try {
         if (file != null) {
           fileName = file.getCanonicalPath();
           reader = new BufferedReader(new FileReader(fileName));
           String line;
           while ((line = reader.readLine()) != null) {
             myPatternList.add(line);
           }
           //							for(int i=0;i<myPatternList.size();i++) {
           //								responseArea.append(myPatternList.get(i)+"\n");
           //							}
         }
         choice = 2;
         reader.close();
       } catch (IOException c) {
         c.printStackTrace();
         Object[] options = new String[] {"Load New File", "Exit"};
         choice =
             JOptionPane.showOptionDialog(
                 null,
                 "Invalid FileChoosen." + "Would you like to load a new file " + "or exit?",
                 "Options",
                 JOptionPane.YES_NO_OPTION,
                 JOptionPane.ERROR_MESSAGE,
                 null,
                 options,
                 options[0]);
         if (choice == 1) System.exit(0);
       }
     } else if (result == JFileChooser.CANCEL_OPTION) {
       Object[] options = new String[] {"Load Different File", "Exit"};
       choice =
           JOptionPane.showOptionDialog(
               null,
               "Would you like to load a new file " + " or exit?",
               "Options",
               JOptionPane.YES_NO_OPTION,
               JOptionPane.ERROR_MESSAGE,
               null,
               options,
               options[0]);
       if (choice == 1) System.exit(0);
     }
   } while (choice == 0);
 }
示例#4
0
  /** Returns false if Exception is thrown. */
  private boolean setDirectory() {
    String pathStr = dirTF.getText().trim();
    if (pathStr.equals("")) pathStr = System.getProperty("user.dir");
    try {
      File dirPath = new File(pathStr);
      if (!dirPath.isDirectory()) {
        if (!dirPath.exists()) {
          if (recursiveCheckBox.isSelected())
            throw new NotDirectoryException(dirPath.getAbsolutePath());
          else throw new NotFileException(dirPath.getAbsolutePath());
        } else {
          convertSet.setFile(dirPath);
          convertSet.setDestinationPath(dirPath.getParentFile());
        }
      } else {
        // Set the descriptors
        setMatchingFileNames();

        FlexFilter flexFilter = new FlexFilter();
        flexFilter.addDescriptors(descriptors);
        flexFilter.setFilesOnly(!recursiveCheckBox.isSelected());

        convertSet.setSourcePath(dirPath, flexFilter);
        convertSet.setDestinationPath(dirPath);
      }
    } catch (NotDirectoryException e1) {
      final String caption = ResourceHandler.getMessage("notdirectory_dialog.caption1");

      MessageFormat formatter;
      String info_msg;
      if (pathStr.equals("")) {
        info_msg = ResourceHandler.getMessage("notdirectory_dialog.info5");
      } else {
        formatter = new MessageFormat(ResourceHandler.getMessage("notdirectory_dialog.info0"));
        info_msg = formatter.format(new Object[] {pathStr});
      }
      final String info = info_msg;

      JOptionPane.showMessageDialog(this, info, caption, JOptionPane.ERROR_MESSAGE);
      return false;
    } catch (NotFileException e2) {
      final String caption = ResourceHandler.getMessage("notdirectory_dialog.caption0");

      MessageFormat formatter =
          new MessageFormat(ResourceHandler.getMessage("notdirectory_dialog.info1"));
      final String info = formatter.format(new Object[] {pathStr});

      JOptionPane.showMessageDialog(this, info, caption, JOptionPane.ERROR_MESSAGE);
      return false;
    }

    return true; // no exception thrown
  }
示例#5
0
    public void actionPerformed(ActionEvent e) {
      JFileChooser chooser = new JFileChooser();
      chooser.setDialogTitle("SaveAs");
      int choice = 0;
      do {
        int result = chooser.showOpenDialog(null);
        if (result == JFileChooser.APPROVE_OPTION) {
          file = chooser.getSelectedFile();
          try {
            if (file != null) {
              fileName = file.getCanonicalPath();
              printWriter = new PrintWriter(new FileOutputStream(fileName), true);
            }
            printWriter.append(responseArea.getText());
            choice = 2;

          } catch (IOException c) {
            c.printStackTrace();
            Object[] options = new String[] {"Choose New File", "Exit"};
            choice =
                JOptionPane.showOptionDialog(
                    null,
                    "Invalid FileChoosen." + "Would you like to choose a new file " + "or exit?",
                    "Options",
                    JOptionPane.YES_NO_OPTION,
                    JOptionPane.ERROR_MESSAGE,
                    null,
                    options,
                    options[0]);
            if (choice == 1) System.exit(0);
          }
        } else if (result == JFileChooser.CANCEL_OPTION) {
          Object[] options = new String[] {"Choose Different File", "Exit"};
          choice =
              JOptionPane.showOptionDialog(
                  null,
                  "Would you like to choose a new file " + " or exit?",
                  "Options",
                  JOptionPane.YES_NO_OPTION,
                  JOptionPane.ERROR_MESSAGE,
                  null,
                  options,
                  options[0]);
          if (choice == 1) System.exit(0);
        }
      } while (choice == 0);
      printWriter.flush();
      printWriter.close();
    }
  /**
   * Checks to see if the sketch has been modified, and if so, asks the user to save the sketch or
   * cancel the export. This prevents issues where an incomplete version of the sketch would be
   * exported, and is a fix for <A HREF="http://dev.processing.org/bugs/show_bug.cgi?id=157">Bug
   * 157</A>
   */
  protected boolean handleExportCheckModified() {
    if (sketch.isModified()) {
      Object[] options = {"OK", "Cancel"};
      int result =
          JOptionPane.showOptionDialog(
              this,
              "Save changes before export?",
              "Save",
              JOptionPane.OK_CANCEL_OPTION,
              JOptionPane.QUESTION_MESSAGE,
              null,
              options,
              options[0]);

      if (result == JOptionPane.OK_OPTION) {
        handleSave(true);

      } else {
        // why it's not CANCEL_OPTION is beyond me (at least on the mac)
        // but f-- it.. let's get this s***e done..
        // } else if (result == JOptionPane.CANCEL_OPTION) {
        statusNotice("Export canceled, changes must first be saved.");
        // toolbar.clear();
        return false;
      }
    }
    return true;
  }
示例#7
0
  private void button1_addActionPerformed(ActionEvent e) {
    // TODO add your code here
    String message = null;
    User user = null;
    try {
      user =
          new User(
              textField1_name.getText(),
              textField2_emeil.getText(),
              Integer.valueOf(textField3_telefon.getText()));
      message = "Успешно создан";
      textField1_name.setText("");
      textField2_emeil.setText("");
      textField3_telefon.setText("");

    } catch (NumberFormatException ex) {
      message = "Разберитесь с телефоном";
    } finally {
      JOptionPane.showMessageDialog(this, message);
    }
    DefaultComboBoxModel<User> qwe = (DefaultComboBoxModel<User>) list1.getModel();
    qwe.addElement(user);
    // list1.setListData();
    // System.out.println(User.getSprUser());

  }
示例#8
0
  public void setPlatform(String platform) {

    final String linux_intel = "linux-intel";
    final String linux_64 = "linux-x86_64";
    final String solaris_sparc = "solaris-sparc";
    final String solaris_64 = "solaris-amd64";
    final String osx_64 = "osx-x86_64";
    final String winxp_32 = "winxp-32";

    if (platform.equals(linux_intel)) {
      linuxIntelCheckBox.setSelected(true);
      linuxIntelCheckBox.setText(linuxIntelCheckBox.getText() + "*");
    } else if (platform.equals(linux_64)) {
      linux64CheckBox.setSelected(true);
      linux64CheckBox.setText(linux64CheckBox.getText() + "*");
    } else if (platform.equals(solaris_sparc)) {
      solarisSparcCheckBox.setSelected(true);
      solarisSparcCheckBox.setText(solarisSparcCheckBox.getText() + "*");
    } else if (platform.equals(solaris_64)) {
      solaris64CheckBox.setSelected(true);
      solaris64CheckBox.setText(solaris64CheckBox.getText() + "*");
    } else if (platform.equals(osx_64)) {
      osxCheckBox.setSelected(true);
      osxCheckBox.setText(osxCheckBox.getText() + "*");
    } else if (platform.equals(winxp_32)) {
      JOptionPane.showMessageDialog(
          null,
          "Platform detected as windows XP. Binaries have not yet been ported, this is an alpha version.");
      windows32Checkbox.setSelected(true);
      windows32Checkbox.setText(windows32Checkbox.getText() + "*");

      StartPanelDescriptor.getInstance().setIsWindows();
    }
  }
示例#9
0
  private void updateEditorView() {
    editorPane.setText("");
    numParameters = 0;
    try {
      java.util.List elements = editableTemplate.getPrintfElements();
      for (Iterator it = elements.iterator(); it.hasNext(); ) {
        PrintfUtil.PrintfElement el = (PrintfUtil.PrintfElement) it.next();
        if (el.getFormat().equals(PrintfUtil.PrintfElement.FORMAT_NONE)) {
          appendText(el.getElement(), PLAIN_ATTR);
        } else {
          insertParameter(
              (ConfigParamDescr) paramKeys.get(el.getElement()),
              el.getFormat(),
              editorPane.getDocument().getLength());
        }
      }
    } catch (Exception ex) {
      JOptionPane.showMessageDialog(
          this,
          "Invalid Format: " + ex.getMessage(),
          "Invalid Printf Format",
          JOptionPane.ERROR_MESSAGE);

      selectedPane = 1;
      printfTabPane.setSelectedIndex(selectedPane);
      updatePane(selectedPane);
    }
  }
示例#10
0
  private boolean checkForSave() {
    // build warning message
    String message;
    if (file == null) {
      message = "File has been modified.  Save changes?";
    } else {
      message = "File \"" + file.getName() + "\" has been modified.  Save changes?";
    }

    // show confirm dialog
    int r =
        JOptionPane.showConfirmDialog(
            this,
            new JLabel(message),
            "Warning!",
            JOptionPane.YES_NO_CANCEL_OPTION,
            JOptionPane.WARNING_MESSAGE);

    if (r == JOptionPane.YES_OPTION) {
      // Save File
      if (fileChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
        // write the file
        physWriteTextFile(fileChooser.getSelectedFile(), textView.getText());
      } else {
        // user cancelled save after all
        return false;
      }
    }
    return r != JOptionPane.CANCEL_OPTION;
  }
示例#11
0
 public void actionPerformed(ActionEvent evt) {
   if (evt.getSource() == ok) dispose();
   else if (evt.getSource() == pluginMgr) {
     new org.gjt.sp.jedit.pluginmgr.PluginManager(
         JOptionPane.getFrameForComponent(ErrorListDialog.this));
   }
 }
示例#12
0
 private void multiConnect() {
   if (jButtonMultiConnect.getText().equals("Multi-Connect")) {
     String res =
         JOptionPane.showInputDialog(this, "Enter number of connections", "Multi-Connect");
     if (res != null) {
       jButtonMultiConnect.setText("Multi-Disconnect");
       jMenuItemTestMulticonnect.setEnabled(false);
       jMenuItemTestMultidisconnect.setEnabled(true);
       int count = Integer.parseInt(res);
       MultiSessions = new Session[count];
       for (int i = 0; i < count; i++) {
         MultiSessions[i] = new Session();
         try {
           MultiSessions[i].connect(
               this.jTextFieldServer.getText(), this.jTextFieldUser.getText() + String.valueOf(i));
         } catch (ConnectionException ex1) {
         }
       }
     }
   } else {
     for (int i = 0; i < MultiSessions.length; i++) {
       try {
         ((Session) MultiSessions[i]).disconnect();
       } catch (Exception ex) {
         System.out.println("Error disconnectiong from session");
       }
     }
     jButtonMultiConnect.setText("Multi-Connect");
     jMenuItemTestMulticonnect.setEnabled(true);
     jMenuItemTestMultidisconnect.setEnabled(false);
   }
 }
示例#13
0
  public void save() {
    BufferedWriter sourceFile = null;

    try {
      String sourceText = sourceArea.getText();

      String cleanText = cleanupSource(sourceText);

      if (cleanText.length() != sourceText.length()) {
        sourceArea.setText(cleanText);

        String message =
            String.format(
                "One or more invalid characters at the end of the source file have been removed.");
        JOptionPane.showMessageDialog(this, message, "ROPE", JOptionPane.INFORMATION_MESSAGE);
      }

      sourceFile = new BufferedWriter(new FileWriter(sourcePath, false));
      sourceFile.write(cleanText);

      setSourceChanged(false);

      setupMenus();
    } catch (IOException ex) {
      ex.printStackTrace();
    } finally {
      if (sourceFile != null) {
        try {
          sourceFile.close();
        } catch (IOException ignore) {
        }
      }
    }
  }
示例#14
0
 public void setResponse(String res) {
   int msgType = JOptionPane.PLAIN_MESSAGE;
   if (res.startsWith("+OK")) msgType = JOptionPane.INFORMATION_MESSAGE;
   if (res.startsWith("-ERR")) msgType = JOptionPane.ERROR_MESSAGE;
   JOptionPane.showMessageDialog(
       QSAdminGUI.this, res.substring(res.indexOf(" ") + 1), "Response", msgType);
 }
示例#15
0
  /**
   * Make the selected line of the table to the given line, if it is displayed. Otherwise a warning
   * message is displayed.
   */
  private void gotoLine() {
    if (gotoTextField.getText().equals("")) {
      return;
    }

    int index = Integer.parseInt(gotoTextField.getText());
    ConstantPoolTableModel model = (ConstantPoolTableModel) table.getModel();

    if (model.isEmpty()) {
      gotoTextField.setText("");
      return;
    }

    if (index < 0 || (model.getFullRowCount() - 1) < index) {
      JOptionPane.showMessageDialog(
          this,
          gotoTextField.getText()
              + " is not in the allowed range [0.."
              + (model.getFullRowCount() - 1)
              + "] !",
          "Warning:",
          JOptionPane.ERROR_MESSAGE);
      gotoTextField.setText("");
      return;
    }

    int indexes[] = model.getIndexes();
    boolean found = false;
    for (int i = 0; i < indexes.length; ++i) {
      if (found = (indexes[i] == index)) {
        table.changeSelection(i, 0, false, false);
        break;
      }
    }

    if (!found) {
      JOptionPane.showMessageDialog(
          this,
          "Index " + gotoTextField.getText() + " is not present in the filtered pool!",
          "Warning:",
          JOptionPane.ERROR_MESSAGE);
      gotoTextField.setText("");
      return;
    }

    gotoTextField.setText("");
  } // gotoLine
示例#16
0
 private void messageStresser() throws HeadlessException {
   String res = JOptionPane.showInputDialog(this, "Number of messages to send");
   try {
     int count = Integer.parseInt(res);
     Thread t = new Thread(new Stresser(count));
     t.start();
   } catch (NumberFormatException nfe) {
   }
 }
示例#17
0
  public void actionPerformed(ActionEvent e) {
    String cmd = (e.getActionCommand());

    if (cmd.equals(aboutItem.getText()))
      JOptionPane.showMessageDialog(
          this,
          "Simple Image Program for DB2004\nversion 0.1\nThanks to BvS",
          "About imageLab",
          JOptionPane.INFORMATION_MESSAGE);
    else if (cmd.equals(quitItem.getText())) System.exit(0);
    else if (cmd.equals(openItem.getText())) {
      int returnVal = chooser.showOpenDialog(this);
      if (returnVal == JFileChooser.APPROVE_OPTION) {
        try {
          pic2 = new Picture(chooser.getSelectedFile().getName());
          pic1 = new Picture(pic2.width(), pic2.height());
          lab.setIcon(pic2.getJLabel().getIcon());
          sliderPanel.setVisible(false);
          pack();
          repaint();
        } catch (Exception ex) {
          JOptionPane.showMessageDialog(
              this,
              "Could not open " + chooser.getSelectedFile().getName() + "\n" + ex.getMessage(),
              "Open Error",
              JOptionPane.INFORMATION_MESSAGE);
        }
      }

    } else if (cmd.equals(saveItem.getText())) {
      int returnVal = chooser.showSaveDialog(this);
      if (returnVal == JFileChooser.APPROVE_OPTION) {
        try {
          pic2.save(chooser.getSelectedFile().getName());
        } catch (Exception ex) {
          JOptionPane.showMessageDialog(
              this,
              "Could not write " + chooser.getSelectedFile().getName() + "\n" + ex.getMessage(),
              "Save Error",
              JOptionPane.INFORMATION_MESSAGE);
        }
      }
    }
  }
示例#18
0
  private void showAboutDialog() {
    final String aboutCaption = ResourceHandler.getMessage("about_dialog.caption");

    // Version string
    final String version = System.getProperty("java.version");

    MessageFormat formatter = new MessageFormat(ResourceHandler.getMessage("about_dialog.info"));
    final String aboutInfo = formatter.format(new Object[] {version});

    JOptionPane.showMessageDialog(this, aboutInfo, aboutCaption, JOptionPane.INFORMATION_MESSAGE);
  }
示例#19
0
  /** Displayed when the template file is not found in the classpath or the working directory. */
  private void showNoTemplateDialog() {
    final String caption = ResourceHandler.getMessage("notemplate_dialog.caption");
    MessageFormat formatter =
        new MessageFormat(ResourceHandler.getMessage("notemplate_dialog.info"));
    final String info =
        formatter.format(new Object[] {PluginConverter.getDefaultTemplateFileName()});

    JOptionPane.showMessageDialog(this, info, caption, JOptionPane.ERROR_MESSAGE);

    System.exit(0);
  }
示例#20
0
  private void saveDataToFile(File file) {
    try {
      PrintStream out = new PrintStream(new FileOutputStream(file));

      // Print header line
      out.print("Time");
      for (Sequence seq : seqs) {
        out.print("," + seq.name);
      }
      out.println();

      // Print data lines
      if (seqs.size() > 0 && seqs.get(0).size > 0) {
        for (int i = 0; i < seqs.get(0).size; i++) {
          double excelTime = toExcelTime(times.time(i));
          out.print(String.format(Locale.ENGLISH, "%.6f", excelTime));
          for (Sequence seq : seqs) {
            out.print("," + getFormattedValue(seq.value(i), false));
          }
          out.println();
        }
      }

      out.close();
      JOptionPane.showMessageDialog(
          this,
          Resources.format(
              Messages.FILE_CHOOSER_SAVED_FILE, file.getAbsolutePath(), file.length()));
    } catch (IOException ex) {
      String msg = ex.getLocalizedMessage();
      String path = file.getAbsolutePath();
      if (msg.startsWith(path)) {
        msg = msg.substring(path.length()).trim();
      }
      JOptionPane.showMessageDialog(
          this,
          Resources.format(Messages.FILE_CHOOSER_SAVE_FAILED_MESSAGE, path, msg),
          Messages.FILE_CHOOSER_SAVE_FAILED_TITLE,
          JOptionPane.ERROR_MESSAGE);
    }
  }
示例#21
0
  /** Set the template file path. */
  private boolean setTemplateFile(String pathStr) {
    File templateFile = new File(templateCh.getSelectedPath(pathStr));

    if (!templateFile.getName().toLowerCase().endsWith(".tpl")) {
      final String templateCaption = ResourceHandler.getMessage("nottemplatefile_dialog.caption");

      MessageFormat formatter =
          new MessageFormat(ResourceHandler.getMessage("nottemplatefile_dialog.info0"));
      final String errorMessage = formatter.format(new Object[] {templateFile.getName()});

      String defaultTemplateName = PluginConverter.getDefaultTemplateFileName();
      JOptionPane.showMessageDialog(this, errorMessage, templateCaption, JOptionPane.ERROR_MESSAGE);

      templateCh.select(templateCh.getPreviousSelection());
      return false;
    }

    try {
      converter.setTemplateFilePath(templateCh.getSelectedPath(pathStr));
    } catch (FileNotFoundException e) {
      // TO-DO:  found it, but it's not a file.
      // TO-DO:  Throw up a Dialog -- "Not a valid file, resetting to default file"

      final String caption = ResourceHandler.getMessage("notdirectory_dialog.caption0");

      MessageFormat formatter;
      String info_msg;
      if (pathStr.equals("")) {
        info_msg = ResourceHandler.getMessage("notdirectory_dialog.info5");
      } else {
        formatter = new MessageFormat(ResourceHandler.getMessage("notdirectory_dialog.info1"));
        info_msg = formatter.format(new Object[] {pathStr});
      }
      final String info = info_msg;

      JOptionPane.showMessageDialog(this, info, caption, JOptionPane.ERROR_MESSAGE);
      return false;
    }

    return true;
  }
示例#22
0
    public void actionPerformed(ActionEvent clickEvent) {

      RecorderDialog recorderInfo = new RecorderDialog(parent);

      recorderInfo.show();

      JOptionPane.showMessageDialog(null, "Clock Reset\nrecordingRTP session...");

      stopRTPrecording.setEnabled(true);

      startRTPrecording.setEnabled(false);
    }
 private void submitActionPerformed(java.awt.event.ActionEvent evt) {
   int numIncorrect = 0;
   for (int i = 0; i < problemDisplays.length; i++) {
     boolean correct = round.getProblem(i).checkAnswer();
     if (correct) {
       problemDisplays[i].disableAnswer();
       problemDisplays[i].setBorder(null);
     } else {
       problemDisplays[i].clearAnswer();
       round.getProblem(i).answer("");
       problemDisplays[i].setBorder(new LineBorder(java.awt.Color.RED));
       numIncorrect++;
     }
   }
   if (numIncorrect == 0) {
     JOptionPane.showMessageDialog(null, "All the answers are correct!");
     round.reset();
     resetProblems();
   } else {
     JOptionPane.showMessageDialog(null, (numIncorrect + " answers were incorrect."));
   }
 }
  public void displayPage(JEditorPane pane, String text) {
    try {
      File helpFile = new File((String) locations.get(text));
      String loc = "file:" + helpFile.getAbsolutePath();
      URL page = new URL(loc);

      pane.setPage(page);

    } catch (IOException ioe) {
      JOptionPane.showMessageDialog(null, "Help Topic Unavailable");
      pane.getParent().repaint();
    }
  }
示例#25
0
  private void assembleAction() {
    String line;
    messages = new Vector();

    mainFrame.resetExecWindow();

    save();

    assembleFailed = false;
    haveAssemblyErrors = false;

    if (Assembler.version()) {
      while ((line = Assembler.output()) != null) {
        messages.addElement(line);
      }

      Assembler.setPaths(baseName, sourcePath);

      if (Assembler.assemble()) {
        while ((line = Assembler.output()) != null) {
          System.out.println(line);

          messages.addElement(line);

          if (line.startsWith(" [ERROR:")) {
            haveAssemblyErrors = true;
          }
        }

        messageList.setListData(messages);
        messageList.ensureIndexIsVisible(0);

        mainFrame.showExecWindow(baseName);
      } else {
        assembleFailed = true;
      }
    } else {
      assembleFailed = true;
    }

    if (assembleFailed) {
      String message =
          String.format(
              "Autocoder failed!\nVerify the correctness of autocoder path\n%s",
              AssemblerOptions.assemblerPath);
      System.out.println(message);

      JOptionPane.showMessageDialog(this, message, "ROPE", JOptionPane.ERROR_MESSAGE);
    }
  }
示例#26
0
 private void about() {
   JOptionPane.showMessageDialog(
       this,
       "QSAdminGUI\n\n"
           + "GUI Client for QSAdminServer of QuickServer.\n"
           + "This is compliant with QuickServer v"
           + QSAdminMain.VERSION_OF_SERVER
           + " release.\n\n"
           + "Copyright (C) QuickServer.org\n"
           + "http://www.quickserver.org",
       "About QSAdminGUI",
       JOptionPane.INFORMATION_MESSAGE,
       logoAbout);
 }
示例#27
0
 void jMenuItemScheduleCommand_actionPerformed(ActionEvent e) {
   try {
     String result = JOptionPane.showInputDialog("Enter <command>,<interval>");
     if (result != null) {
       StringTokenizer st = new StringTokenizer(result, ",");
       if (st.countTokens() == 2) {
         String command = st.nextToken();
         long interval = Long.parseLong(st.nextToken());
         CommandScheduler.create(command, interval * 1000);
       }
     }
   } catch (Exception ex) {
   }
 }
示例#28
0
  public void CheckAtTheEnd() // 当无子可落时判断胜负
      {
    ShowChessNumber();
    gameStart = false;

    for (int i = 0; i < 8; i++) for (int j = 0; j < 8; j++) cell[i][j].taken = true;

    String winner = "";

    if (white > black) {
      controlThread = false;
      JOptionPane.showMessageDialog(null, "白方胜!" + white + ":" + black);
      winner = "白";
    } else if (white < black) {
      controlThread = false;
      JOptionPane.showMessageDialog(null, "黑方胜!" + black + ":" + white);
      winner = "黑";
    } else if (white == black) {
      controlThread = false;
      JOptionPane.showMessageDialog(null, "和局!");
      winner = "";
    }
    //	JOptionPane.showMessageDialog(null, "游戏结束!用时" + time + "秒");
  }
示例#29
0
  public PrintfEditor(Frame frame, String title) {
    super(frame, title, false);

    originalTemplate = new PrintfTemplate();
    editableTemplate = new PrintfTemplate();
    try {
      jbInit();
      pack();
      initMatches();
    } catch (Exception exc) {
      String logMessage = "Could not set up the printf editor";
      logger.critical(logMessage, exc);
      JOptionPane.showMessageDialog(frame, logMessage, "Printf Editor", JOptionPane.ERROR_MESSAGE);
    }
  }
示例#30
0
  /**
   * Read word list from file with name WORDLISTFILENAME, and pass a Set containing those words to
   * the computer player to intialize its lexicon.
   */
  private void initLexicon(InputStream stream) {

    ProgressMonitorInputStream pmis;
    ProgressMonitor progress = null;
    pmis = new ProgressMonitorInputStream(this, "reading words", stream);
    progress = pmis.getProgressMonitor();
    progress.setMillisToDecideToPopup(10);
    Scanner s = new Scanner(pmis);
    myLexicon.load(s);
    try {
      pmis.close();
    } catch (IOException e) {
      JOptionPane.showMessageDialog(
          null, "Error Closing Stream", "Error", JOptionPane.ERROR_MESSAGE);
    }
  }