aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Having some problem with FileDialog Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Having some problem with FileDialog " Watch "Having some problem with FileDialog " New topic
Author

Having some problem with FileDialog

vamsi naki
Ranch Hand

Joined: May 18, 2011
Posts: 46
Hi ,
I wrote a porgam where there is a textarea and two buttons ,one to load files into the textarea and other button to save what is written in the text area.
I have two problems though
1)The methods filedialog.getDirectory(),filedialog.getFile() return nulll so i am not able to load any file in the text area
2)When i try to save a file ,i used filedialog.setDirectory("C:"+"\" ") and filedialog.setFile("untitled.txt").The problem is it doesnt show the c:\ as the default directory when the dialog box opens .


Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

vamsi naki wrote:2)When i try to save a file ,i used filedialog.setDirectory("C:"+"\" ")


In other words, you set the directory to this string:



But you really wanted this string, right?



So you've just got your Java string escaping rules a bit mixed up. You need this code:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Having some problem with FileDialog