Novicane All American 15416 Posts user info edit post |
I have my load working (filter is another class):
String name; JFileChooser chooser = new JFileChooser(); //<-- Opens a pop up choosers File file = chooser.getSelectedFile(); //<-- sets filter chooser.setFileFilter(new OurFilter()); int status = chooser.showOpenDialog(null); name = file.getName();
// reads file (objectInputStream and readObject stuff) //end
now for save I am a little confused:
String name; JFileChooser chooser = new JFileChooser(); //<-- Opens a pop up choosers File file = chooser.getSelectedFile(); //<-- sets filter chooser.setFileFilter(new OurFilter()); int status = chooser.showSaveDialog(null); name = file.getName();
// proceeds to write to the file using writeObject and closes stream //end
When i save the file it won't save for some reason when I go back to browse to load it.3/8/2006 12:39:17 PM |
Novicane All American 15416 Posts user info edit post |
bttt
come on java d0rks, plz speaketh 3/8/2006 4:57:41 PM |
TJB627 All American 2110 Posts user info edit post |
this may or may not be the problem but just out of curiosity, are both of those snippets of code in the same method? 3/8/2006 5:11:38 PM |
Novicane All American 15416 Posts user info edit post |
I have a saveAll() method that writes three or four different lists
and a loadAll() method that should load the lists from the "name" of the selected file
these methods run depending on which Jmenu item is picked 3/8/2006 5:27:14 PM |
TJB627 All American 2110 Posts user info edit post |
I haven't actually messed with JFileChooser's myself but I'll see if I can play around with one here sometime soon. What I was thinking though is that maybe theres some kind of problem relating to trying to load/save the same file, I was having a similar problem the other day with a BufferedReader/FileWriter. 3/9/2006 12:26:13 AM |
Novicane All American 15416 Posts user info edit post |
I pretty sure the problem is my syntax some where. Because when I specify the file name ("alllist.dat") instead of using JFileChooser, it works 3/9/2006 8:01:27 AM |