i want that when i select a file from a specific location using JFileChooser then it must save the path of that file upto some location, so that next when i open JFileChooser Dialog to open some other file then i do not have to specify it the path of that file from the root, since they being in the same directory. Same i want in the case of FileDialog also. i hope that the problem is clear. plz reply me soob from hema
getParent() returns you a String while getParentFile() returns you a File object For FileDialog do following after the user selects a file String dir = fd.getDirectory(); if (dir != null) fd.setDirectory(dir); [ January 24, 2002: Message edited by: kawaii desu ]
Rashid Ali
Ranch Hand
Joined: Jan 16, 2001
Posts: 349
posted
0
Thanks Kawaii that's detailed and good information. Rashid
hema narayan
Greenhorn
Joined: Dec 28, 2001
Posts: 6
posted
0
Thanks Kawaii for your detailed and well explained answer to my problem hema
suheel hussain
Greenhorn
Joined: Nov 01, 2001
Posts: 16
posted
0
Another easy way is to create JFileChooser at the start of application and keep this chooser until end of application. public class blahblah { private JFileChooser chooser = new JFileChooser; // local public and private functions } // end of application since chooser has a class scope, it retains last selected directory/file information.