public void actionPerformed(ActionEvent e)
    {
        Object source = e.getSource();

        if (source == saveButton)
        {
            Dimension size = this.getSize();
            BufferedImage image = (BufferedImage) this.createImage(size.width,
                    size.height);
            Graphics g = image.getGraphics();
            this.paint(g);
            g.dispose();

            JFileChooser fileChooser = new JFileChooser();
            ExtensionFileFilter filterPNG = new ExtensionFileFilter(
                    "PNG Image Files", ".png");
            ExtensionFileFilter filterJPG = new ExtensionFileFilter(
                    "JPG Image Files", ".jpg");
            fileChooser.addChoosableFileFilter(filterPNG);
            fileChooser.addChoosableFileFilter(filterJPG);
            fileChooser.setFileFilter(filterJPG);
            fileChooser.setCurrentDirectory(new File(prefs.GetImageDir()));
            int option = fileChooser.showSaveDialog(this);
            if (option == JFileChooser.APPROVE_OPTION)
            {
                String filename = fileChooser.getSelectedFile().getPath();
                if (fileChooser.getFileFilter() == filterPNG)
                {
                    if (!(filename.endsWith(".png")))
                    {
                        filename = filename + ".png";
                    }
                } else if (fileChooser.getFileFilter() == filterJPG)
                {
                    if (!(filename.endsWith(".jpg")))
                    {
                        filename = filename + ".jpg";
                    }
                }

                try
                {
                    prefs.SetImageDir(fileChooser.getCurrentDirectory().getAbsolutePath());
                    if (filename.endsWith(".png"))
                    {
                        ImageIO.write(image, "png", new File(filename));
                    } else
                    {
                        ImageIO.write(image, "jpg", new File(filename));
                    }
                } catch (IOException exc)
                {
                    System.err.println("Unable to save window image to " + filename);
                    exc.printStackTrace();
                }
            } // User said save
        } // SaveButton pushed
        else if (source == doneButton)
        {
            prefs.SetAngleOriginX(this.getX());
            prefs.SetAngleOriginY(this.getY());
            prefs.SetAngleHeight(this.getHeight());
            prefs.SetAngleWidth(this.getWidth());
            prefs.SavePrefs();
            setVisible(false);
        }
    } // actionPerformed()