gt:       cancelButton = new JButton(I18n.PROMPT_CANCEL);
context: /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
  
  /*
    Part of the Processing project - http://processing.org
  
    Copyright (c) 2004-08 Ben Fry and Casey Reas
    Copyright (c) 2001-04 Massachusetts Institute of Technology
  
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
  
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
  
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
  
  package processing.app;
  
  import java.awt.*;
  import java.awt.event.*;
  import javax.swing.*;
  
  import java.awt.datatransfer.*;
  import static processing.app.I18n._;
  
  
  /**
   * Panel just below the editing area that contains status messages.
   */
  public class EditorStatus extends JPanel /*implements ActionListener*/ {
    static Color bgcolor[];
    static Color fgcolor[];
  
    static final int NOTICE = 0;
    static final int ERR    = 1;
    //static final int PROMPT = 2;
    //static final int EDIT   = 3;
    static final int EDIT   = 2;
    static final int PROGRESS = 5;
  
    static final int YES    = 1;
    static final int NO     = 2;
    static final int CANCEL = 3;
    static final int OK     = 4;
  
    static final String NO_MESSAGE = "";
  
    Editor editor;
  
    int mode;
    String message;
  
    Font font;
    FontMetrics metrics;
    int ascent;
  
    Image offscreen;
    int sizeW, sizeH;
    int imageW, imageH;
  
    //JButton yesButton;
    //JButton noButton;
    JButton cancelButton;
    JButton okButton;
    JTextField editField;
    JProgressBar progressBar;
    JButton copyErrorButton;
  
    //Thread promptThread;
    int response;
  
    boolean initialized = false;
  
    public EditorStatus(Editor editor) {
      this.editor = editor;
      empty();
  
      if (bgcolor == null) {
        bgcolor = new Color[6];
        bgcolor[0] = Theme.getColor("status.notice.bgcolor");
        bgcolor[1] = Theme.getColor("status.error.bgcolor");
        bgcolor[2] = Theme.getColor("status.edit.bgcolor");
        bgcolor[3] = null;
        bgcolor[4] = null;
        bgcolor[5] = Theme.getColor("status.notice.bgcolor");
  
        fgcolor = new Color[6];
        fgcolor[0] = Theme.getColor("status.notice.fgcolor");
        fgcolor[1] = Theme.getColor("status.error.fgcolor");
        fgcolor[2] = Theme.getColor("status.edit.fgcolor");
        fgcolor[3] = null;
        fgcolor[4] = null;
        fgcolor[5] = Theme.getColor("status.notice.fgcolor");
  }
    }
  
  
    public void empty() {
      mode = NOTICE;
      message = NO_MESSAGE;
      //update();
      repaint();
    }
  
  
    public void notice(String message) {
      mode = NOTICE;
      this.message = message;
      copyErrorButton.setVisible(false);
      //update();
      repaint();
    }
  
    public void unnotice(String unmessage) {
      if (message.equals(unmessage)) empty();
    }
  
  
    public void error(String message) {
      mode = ERR;
      this.message = message;
      copyErrorButton.setVisible(true);
      repaint();
    }
  
  
    /*
    public void prompt(String message) {
      mode = PROMPT;
      this.message = message;
  
      response = 0;
      yesButton.setVisible(true);
      noButton.setVisible(true);
      cancelButton.setVisible(true);
      yesButton.requestFocus();
  
      repaint();
    }
  
  
    // prompt has been handled, re-hide the buttons
    public void unprompt() {
      yesButton.setVisible(false);
      noButton.setVisible(false);
      cancelButton.setVisible(false);
      empty();
    }
    */
  
  
    public void edit(String message, String dflt) {
      mode = EDIT;
      this.message = message;
  
      response = 0;
      okButton.setVisible(true);
      cancelButton.setVisible(true);
      editField.setVisible(true);
      editField.setText(dflt);
      editField.selectAll();
      editField.requestFocus();
  
      repaint();
    }
  
    public void unedit() {
      okButton.setVisible(false);
      cancelButton.setVisible(false);
      editField.setVisible(false);
      empty();
    }
  
    public void progress(String message)
    {
      mode = PROGRESS;
      this.message = message;
      progressBar.setIndeterminate(false);
      progressBar.setVisible(true);
      copyErrorButton.setVisible(false);
      setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
      repaint();
    }
  
    
    public void progressIndeterminate(String message)
    {
      mode = PROGRESS;
      this.message = message;
      progressBar.setIndeterminate(true);
      progressBar.setValue(50);
      progressBar.setVisible(true);
      copyErrorButton.setVisible(false);
      setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
      repaint();
    }
  
    
    public void progressNotice(String message) {
      //mode = NOTICE;
      this.message = message;
      //update();
      repaint();
    }
    
    
    public void unprogress()
    {
      if (Preferences.getBoolean("editor.beep.compile")) {
        Toolkit.getDefaultToolkit().beep();
      }
      if (progressBar == null) return;
      progressBar.setVisible(false);
      progressBar.setValue(0);
      setCursor(null);
      //empty();
    }
    
    
    public void progressUpdate(int value)
    {
      if (progressBar == null) return;
      progressBar.setValue(value);
      repaint();
    }
  
    /*
    public void update() {
      Graphics g = this.getGraphics();
      try {
        setBackground(bgcolor[mode]);
      } catch (NullPointerException e) { } // if not ready yet
      if (g != null) paint(g);
    }
  
    public void update(Graphics g) {
      paint(g);
    }
    */
  
  
    public void paintComponent(Graphics screen) {
      //if (screen == null) return;
      if (!initialized) {
        setup();
        initialized = true;
      }
  
      //System.out.println("status.paintComponent");
  
      Dimension size = getSize();
      if ((size.width != sizeW) || (size.height != sizeH)) {
        // component has been resized
  
        if ((size.width > imageW) || (size.height > imageH)) {
          // nix the image and recreate, it's too small
          offscreen = null;
  
        } else {
          // who cares, just resize
          sizeW = size.width;
          sizeH = size.height;
          setButtonBounds();
        }
      }
  
      if (offscreen == null) {
        sizeW = size.width;
        sizeH = size.height;
        setButtonBounds();
        imageW = sizeW;
        imageH = sizeH;
        offscreen = createImage(imageW, imageH);
      }
  
      Graphics g = offscreen.getGraphics();
      if (font == null) {
        font = Theme.getFont("status.font");
        //new Font("SansSerif", Font.PLAIN, 12));
        g.setFont(font);
        metrics = g.getFontMetrics();
        ascent = metrics.getAscent();
      }
  
      //setBackground(bgcolor[mode]);  // does nothing
  
      g.setColor(bgcolor[mode]);
      g.fillRect(0, 0, imageW, imageH);
  
      g.setColor(fgcolor[mode]);
      g.setFont(font); // needs to be set each time on osx
      g.drawString(message, Preferences.GUI_SMALL, (sizeH + ascent) / 2);
  
      screen.drawImage(offscreen, 0, 0, null);
    }
  
  
    protected void setup() {
      if (okButton == null) {
  