JFileChooser extension [duplicate]
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.
精彩评论