private void openFile(){
        JFileChooser fileChooser = new JFileChooser();
        int i = fileChooser.showOpenDialog(window);
        if (i == JFileChooser.APPROVE_OPTION) {
            try{
                File file = fileChooser.getSelectedFile();
                ObjectInputStream in = new ObjectInputStream(
                                    new FileInputStream(file));
                Graph graph = (Graph) in.readObject();
                PSTricksGraphEditor.graph = graph;
                in.close();
                PSTricksGraphEditor.canvas.validate();
                PSTricksGraphEditor.canvas.repaint();
                } catch (IOException exception){
                    JOptionPane.showMessageDialog(null, exception);
                } catch (ClassNotFoundException exception){
                    JOptionPane.showMessageDialog(null,exception);
                }
        }
    }