private void saveMenuButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveMenuButtonActionPerformed
        String s = "";
        int[][] theGrid = gridToArray();
        for(int i=0; i<9; i++){
            for(int j=0; j<9; j++){
                s+=theGrid[j][i];
            }
            if(i!=8) s+="\n";
        }
        if(saveFC.showSaveDialog(this) ==  javax.swing.JFileChooser.APPROVE_OPTION){
            File file = saveFC.getSelectedFile();
            String fileName = file.getName();
            if(fileName.indexOf(".sdg") == -1){
                fileName+=".sdg";
                file = new File(file.getParentFile(), fileName);
            }
            try {
                //javax.swing.JOptionPane.showMessageDialog(null, file);
                Writer output = new BufferedWriter(new FileWriter(file));
                try {
                    //FileWriter always assumes default encoding is OK!
                    output.write(s);
                }
                catch(Exception e){
                    javax.swing.JOptionPane.showMessageDialog(this, "There was a problem saving the file:\n "+e);
                }
                finally {
                    output.close();
                }
            } catch (IOException ex) {
                javax.swing.JOptionPane.showMessageDialog(this, "There was a problem saving the file:\n "+ex);
            }

        }
    }//GEN-LAST:event_saveMenuButtonActionPerformed