Пример #1
0
 public void evaluate() {
   try {
     // clear problems and console messages
     problemsView.setText("");
     consoleView.setText("");
     // update status view
     statusView.setText(" Parsing ...");
     tabbedPane.setSelectedIndex(0);
     LispExpr root = Parser.parse(textView.getText());
     statusView.setText(" Running ...");
     tabbedPane.setSelectedIndex(1);
     // update run button
     runButton.setIcon(stopImage);
     runButton.setActionCommand("Stop");
     // start run thread
     runThread = new RunThread(root);
     runThread.start();
   } catch (SyntaxError e) {
     tabbedPane.setSelectedIndex(0);
     System.err.println(
         "Syntax Error at " + e.getLine() + ", " + e.getColumn() + " : " + e.getMessage());
   } catch (Error e) {
     // parsing error
     System.err.println(e.getMessage());
     statusView.setText(" Errors.");
   }
 }
Пример #2
0
  private JButton makeToolbarButton(String name, String toolTipText, String action) {
    // Create and initialize the button.
    JButton button = new JButton(makeImageIcon(name));
    button.setToolTipText(toolTipText);
    button.setActionCommand(action);
    button.addActionListener(this);

    return button;
  }
Пример #3
0
 public void runFinished() {
   // program execution finished so update
   // status and run button accordingly
   if (runThread == null) {
     // _runThread = null only if
     // execution stopped by user via
     // run button
     statusView.setText(" Stopped.");
   } else {
     statusView.setText(" Done.");
   }
   runButton.setActionCommand("Run");
   runButton.setIcon(runImage);
 }