public MySnapshot ( Image grabbedFrame, Dimension imageSize )
        {
            super ( );

            shotNumber = shotCounter++;
            setTitle ( "Photo" + shotNumber );

            photo = grabbedFrame;

            setDefaultCloseOperation ( WindowConstants.DISPOSE_ON_CLOSE );

            int imageHeight = photo.getWidth  ( this );
            int imageWidth  = photo.getHeight ( this );

            setSize ( imageSize.width, imageSize.height );

            final FileDialog saveDialog = new FileDialog ( this, "Save JPEG", FileDialog.SAVE );
            final JFrame thisCopy = this;
            saveDialog.setFile ( "Photo" + shotNumber );

            addWindowListener ( new WindowAdapter()
                {
                    public void windowClosing ( WindowEvent e )
                    {
                        saveDialog.show();

                        String filename = saveDialog.getFile();

                        if ( filename != null )
                        {
                            if ( saveJPEG ( filename ) )
                            {
                                JOptionPane.showMessageDialog ( thisCopy, "Saved " + filename );
                                setVisible ( false );
                                dispose();
                            }
                            else
                            {
                                JOptionPane.showMessageDialog ( thisCopy, "Error saving " + filename );
                            }
                        }
                        else
                        {
                            setVisible ( false );
                            dispose();
                        }
                    }
                }
            );

            setVisible ( true );
        }