简体   繁体   English

有没有一种方法可以将JFileChooser设置为从某个文件开始?

[英]Is there a way to set a JFileChooser to start from a certain file?

I've created a file chooser as such: 我已经创建了一个文件选择器,例如:

private JFileChooser jfc = new JFileChooser(".");

Now this obviously opens up the current folder, in eclipse its the workshop folder. 现在,这显然打开了当前文件夹,使Eclipse的Workshop文件夹黯然失色。 How do I make it so that it starts from where I have a certain file. 如何使它从我拥有某个文件的位置开始。 I tried: 我试过了:

private JFileChooser jfc = new JFileChooser("pictureFile.png");

but it doesn't go to the file with that name. 但不会转到具有该名称的文件。

EDIT: 编辑:

Is there a way to add a picture file to my package folder for the project in eclipse? 有没有办法在Eclipse中将图片文件添加到我的项目的包文件夹中?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM