Writing data on a .txt file<>
This question already has an answer here:
you have to close your BufferedWriter, using BufferedWriter#close()
For ease, also use JTextComponent.write(java.io.Writer).
also if i want to save those values in a user specified .txt file how can it be done?
Offer the user a JFileChooser as seen in this example.
Establish the FileWriter from the file returned (after checking it ends with .txt).