I want to Know how i can to create a FolderFileWrapper for create a new folder without use FileChooser. The idea is create new folders with programming code and i dont know how do it. Note that i like to specify the folders name.
Thank you. :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The simple answer there is to use MailFileSystemView.createFileObject(File dir, String filename), followed by FolderFileWrapper.createNewFile(). Or, heck, you could even use FolderFileWrapper.getFileByName(String filename) followed by FolderFileWrapper.createNewFile().
If you're looking to create a Folder that can hold other folders, use FolderFileWrapper.getFileByName(String filename) followed by FolderFileWrapper.mkdir().
You may also need to run FolderFileWrapper.refreshChildren() after you call createNewFile() or mkdir(). ...That should probably be done automatically, come to think of it. Actually, FolderFileWrapper should really implement javax.mail.event.FolderListener, and then it could call refreshChildren() even when a new child was created/deleted by an external event. But, well, it works ok for me right now, and I have lots more on my plate.... So manually calling refreshChildren() it is! :)
Anyway. Those _should_ work. I wrote the FolderFileWrapper code specifically to work with the JFileChooser, so I haven't actually run it through all possibilities.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello:
I want to Know how i can to create a FolderFileWrapper for create a new folder without use FileChooser. The idea is create new folders with programming code and i dont know how do it. Note that i like to specify the folders name.
Thank you. :)
Hi.
The simple answer there is to use MailFileSystemView.createFileObject(File dir, String filename), followed by FolderFileWrapper.createNewFile(). Or, heck, you could even use FolderFileWrapper.getFileByName(String filename) followed by FolderFileWrapper.createNewFile().
If you're looking to create a Folder that can hold other folders, use FolderFileWrapper.getFileByName(String filename) followed by FolderFileWrapper.mkdir().
You may also need to run FolderFileWrapper.refreshChildren() after you call createNewFile() or mkdir(). ...That should probably be done automatically, come to think of it. Actually, FolderFileWrapper should really implement javax.mail.event.FolderListener, and then it could call refreshChildren() even when a new child was created/deleted by an external event. But, well, it works ok for me right now, and I have lots more on my plate.... So manually calling refreshChildren() it is! :)
Anyway. Those _should_ work. I wrote the FolderFileWrapper code specifically to work with the JFileChooser, so I haven't actually run it through all possibilities.