Welcome to the Ranch
The file chooser doesn't save your file. What it does is allow you to find your file. Once the file is found you will have to write to it. You can read about file choosers in the
Java® Tutorials. You appear to have a writing method in the second bit of code. Some style which needs improving however. You should change anything which looks like this:-
to this:-
What happens when you print a boolean[]? I know you can't simply write
Well, you can, but since arrays never override toString, you won't get a helpful output. You can try
… and you can read about that method
here. That will probably print
[true,false,false,true,...true] or similar.
In your line 10 you are using a “writer”. Is that a
BufferedWriter? If so, remember that a BufferedWriter writes text. So if you get it to work your file will contain similar text to what I showed you earlier.
Alternative: Iterate the array and use the ?: operator to tell the writer what to write
You might do well to find out about Scanner and Formatter for reading and writing. You can use the %b and %n tags wtih Formatter for the output. You will have to work out what delimiter to use for a Scanner, but for the 256‑line version the default delimiter will probably do nicely. You can use the nextXXX methods of the Scanner to get different kinds of data from a text file.
If you have an array of check boxes, you don't need a boolean[]. You can simply iterate the box array and use its isSelected() method or similar to get the boolean, and you don't need the second array.