@Override
  public void buttonClicked(JButton button)
  {
    if (button == cancel)
    {
      fileName.setText("");
      setVisible(false);
    }
    else if (button == browse)
    {
      int choice = fc.showSaveDialog(this);
      
      if (choice == JFileChooser.APPROVE_OPTION)
      {
        File file = fc.getSelectedFile();
        String name = file.getName();
        if (!name.endsWith(".png"))
        {
          if (name.charAt(name.length()-1) == '.')
            file = new File(file.getAbsoluteFile()+"png");
          else
            file = new File(file.getAbsoluteFile()+".png");
        }
        fileName.setText(file.getAbsolutePath());
      }
    }
    else if (button == execute)
    {
      if (file == null && fileName.getText().equals(""))
      {
        Dialogs.showErrorDialog(this, "Error", "Please specify an output file name");
        return;
      }
      
      file = new File(fileName.getText());
      
      Task task = new Tasks.ExportModelImageTask(this, model, file, showCaps.isSelected(), allRotations.isSelected());
      if (task.execute())
        this.setVisible(false);
    }
  }