开发者

JFileChooser extension [duplicate]

This question already has an answer here: Closed 11 years ago.

Possible Duplicate:

I need to display the file name without the extension in JFileChooser(open mode). How?

Can anyone tell me how switch off extensions in view openDialog ? I want see only name file without his extension in this vie开发者_开发知识库w. thanks


you can use a custom writen javax.swing.filechooser.FileView that you set in your filechooser


The Customizing the File View section in the Java Tutorial includes an example of defining your own FileView object to control how the files are displayed in a JFileChooser.

http://download.oracle.com/javase/tutorial/uiswing/components/filechooser.html

Override the FileView.getName() method to display a customized name for each file.

Download the FileChooserDemo2 demo from this web page to try the example and change method ImageFileView.getName() to return the filename with the file extension removed.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜