You're using a Scanner
in the ListenMenuSave
ActionListener
for the mnuItemSave
JMenuItem
which is attempting to read the selected file in the save JFileChooser.
Use JTextComponent#write to write the contents of the JTextArea
instead.
PrintWriter writer = new PrintWriter(sFile.getSelectedFile());
ta.write(writer);
Remember to invoke writer.close()
in a finally
block to write any unwritten buffered data to disk.