Creating a folder to write files to...

Hi, Is it possible to get the user to choose a folder name the same way you would a normal file to save, then write the output stream to this newly created folder?Thanks,Bex
[194 byte] By [Explosion_Of_Coloura] at [2007-10-2 16:24:10]
# 1
> Hi, Is it possible to get the user to choose a folder name the same way you would a normal file to saveYes>then write the output stream to this newly created folder?No, you have to write to a newly created file which resides in the newly created folder.
IanSchneidera at 2007-7-13 17:21:57 > top of Java-index,Core,Core APIs...
# 2
Lol, okay very badly worded sorry. I'm using BufferedWriter so im hoping its a very simple difference between files and folders.How would I go about this then?Thanks alot,Bex
Explosion_Of_Coloura at 2007-7-13 17:21:57 > top of Java-index,Core,Core APIs...
# 3

new java.io.File("MyNewDirectoryName").mkdir();

And it returns a boolean status, if you want to know if it was successful.

new java.io.File("MyNewParentDirectory/MyNewDirectoryName").mkdirs();

To create the parents as necessary. Also returns a status.

MLRona at 2007-7-13 17:21:57 > top of Java-index,Core,Core APIs...
# 4
Thats fantastic, thanks so much!Bex
Explosion_Of_Coloura at 2007-7-13 17:21:57 > top of Java-index,Core,Core APIs...
# 5
Hi, I'm having problems implementing the JFileChooser part of this as the user is meant to specify the name of the folder :SThanks!Bex
Explosion_Of_Coloura at 2007-7-13 17:21:57 > top of Java-index,Core,Core APIs...
# 6

I did a quick Google search for "Java Swing select directory" and came up with this link:

http://www.rgagnon.com/javadetails/java-0370.html

'course, I don't like how that feels m'self so I implemented a directory chooser in the form of a tree. :-P But that's not quite as simple. Cheers!

tvynra at 2007-7-13 17:21:57 > top of Java-index,Core,Core APIs...