Ok I have a question.. suppose you have a program ( an application NOT an applet) and say on this application you are allowing to add and buttons to the JPanel and move the buttons around. Say on thi application you have a menubar and on this menubar you have the options of Openning and saving your files. I have 2 questions: 1) How do you access the hardrive/drives or even floppy disks from the open or save options. Does anyone have any code or any sites? 2) How do you save your file. For example how do you give it an extention. You know how Microsoft word has the extension .doc . Lets say I added a few buttons and positioned them on teh screen how I want to and then I wante dto save this configuration so tomorrow I can open it back up and all these buttons are in the same place I left them and I also wanted to save the file to the name "Button.zzz" ..lets assume I want my extension to be "zzz" ..how do I do this. Please NO applets.. This is strictly an Application... thanks in advance.... thanks for reading.. I know its a bit of a difficult question... but could u please give it a try..
Hi Avin, It is not a difficult question. Just use the JFileChooser and it will do all that low level stuff like figuring out which drives are available, allowing a user to select a directory, or looking for a certain extension. Just look at the API to see how simple it is to use. Also you can look at the examples that sun provides: http://java.sun.com/docs/books/tutorial/uiswing/components/filechooser.html Regards, Manfred.
First of all, you can list the drives and floppies using fileChooser.getFileSystemView().getRoots() method of jfilechooser.FileSystemView class. But actually, I have a different question. JFileChooser is a rather dull and awkward class. Does anybody know a better class that would be available for public use? See, I just tried to do one simple thing, replace FileView in JFileChooser, to display the sizes and the timestamps of the files - oops! multiple file selection stopped working; and the strange editing feature (it seems like you can rename file in file chooser) has gone wild.