public void windowClosing(WindowEvent e) {


        {
            if (!savePending) {
                OpeningFrame.this.dispose();
                return;
            }
            int choice = JOptionPane.showConfirmDialog(OpeningFrame.this, "Save the current  screen before exit?");
            if (choice == JOptionPane.CANCEL_OPTION || choice == JOptionPane.CLOSED_OPTION) {
                return;
            }
            if (choice == JOptionPane.NO_OPTION) {
                OpeningFrame.this.dispose();
            }
            if (choice == JOptionPane.YES_OPTION) {

                try {
                    if (openFile == null) {
                        File directory = getFileDirectory();
                        JFileChooser chooser = new JFileChooser(directory);

                        chooser.showSaveDialog(OpeningFrame.this);

                        openFile = chooser.getSelectedFile();
                        if (chooser.getCurrentDirectory() != null) {
                            OpeningFrame.this.saveFileDirectory(chooser.getCurrentDirectory());
                        }
                    }
                    if (openFile == null) {
                        return;
                    }

                    ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream(openFile));
                    os.writeObject(new EntryValues(entryPanel));
                    OpeningFrame.this.savePending = false;
                    OpeningFrame.this.saveMarker = "";
                    OpeningFrame.this.setTitle(baseTitle + "  :  " + saveMarker + openFile.getName());
                } catch (Exception ex) {
                    JOptionPane.showMessageDialog(OpeningFrame.this, "Cannot save . Please check filename");
                }

            }
            OpeningFrame.this.dispose();
        }
    }