开发者

How to make the JFileChooser to return the file or directory path containing the forward slash in stead of backward slash in java?

I have implemented JFileChooser of Java swing successfully. As the implemented JFileChooser gives file or directory path with backward slash as a file separator on windows os. My question i开发者_开发问答s how to make this JFileChooser to return the file or directory path containing the forward slash in stead of backward slash as path separator in java independent of windows os or any other os?

Please guide me Friends!

Thank You!


Normally, you don't have to care about forward/backward slashes. The JFileChooser will return the path so that it is suitable for the machine it is running on.


The File class actually abstracts you of this task. The JFileChooser return a File object, then you can call its getCanonicalPath method (for instance) which has a different format depending on the OS.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜