java中FileDialog设置默认路径问题 10
2个回答
推荐于2018-04-15 · 知道合伙人数码行家
关注
展开全部
你好,我帮你查了以下jdk 的API:
public void setFilterPath(String string)
Sets the directory path that the dialog will use to the
argument, which may be null. File names in this path will appear in the dialog,
filtered according to the filter extensions. If the string is null, then the
operating system's default filter path will be used.
Note that the path string is platform dependent. For convenience, either '/'
or '\' can be used as a path separator.
Parameters:
string - the directory path
See Also:
setFilterExtensions(java.lang.String[])
你这里要写文件的全路径啊:D:\\test\\aa.txt
这样就对了,反斜杠要转义的!
(*^__^*)温馨提示(*^__^*)
真心希望你能采纳我的回答,如有不明白,可以继续追问,若满意,记得及时采纳。
public void setFilterPath(String string)
Sets the directory path that the dialog will use to the
argument, which may be null. File names in this path will appear in the dialog,
filtered according to the filter extensions. If the string is null, then the
operating system's default filter path will be used.
Note that the path string is platform dependent. For convenience, either '/'
or '\' can be used as a path separator.
Parameters:
string - the directory path
See Also:
setFilterExtensions(java.lang.String[])
你这里要写文件的全路径啊:D:\\test\\aa.txt
这样就对了,反斜杠要转义的!
(*^__^*)温馨提示(*^__^*)
真心希望你能采纳我的回答,如有不明白,可以继续追问,若满意,记得及时采纳。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询