可能重复:
I need to display the file name without the extension in JFileChooser(open mode). How?
有人能告诉我如何在视图openDialog中关闭扩展吗?在这个视图中,我只想看到没有他扩展名的名字文件。谢谢
发布于 2011-09-16 06:39:53
您可以使用在文件回波器中设置的自定义写javax.swing.filechooser.FileView。
发布于 2011-09-16 06:59:23
Java教程中的自定义文件视图部分包括一个定义自己的FileView对象以控制文件如何在JFileChooser中显示的示例。
http://download.oracle.com/javase/tutorial/uiswing/components/filechooser.html
重写FileView.getName()方法以显示每个文件的自定义名称。
从此网页下载FileChooserDemo2演示程序,尝试使用示例和更改方法ImageFileView.getName()返回文件扩展名已删除的文件名。
https://stackoverflow.com/questions/7440370
复制相似问题