private void saveFile(){
        JFileChooser fileChooser = new JFileChooser();
        if (fileChooser.showSaveDialog(window) == JFileChooser.APPROVE_OPTION){
            try{
                File file = fileChooser.getSelectedFile();
                ObjectOutputStream out = new ObjectOutputStream(
                                         new FileOutputStream(file+".pst"));
                out.writeObject(PSTricksGraphEditor.graph);
                out.close();
            }catch (IOException exception){
                    JOptionPane.showMessageDialog(null,exception);
            }
        }
    }