I use \'JFileChooser\' in open mode. I need to display the \'file name\' field without the extension. How?? I know the FileView. It remove extensions in file system\'s files, b
The underlying reason is that the ui doesn't use the view's name as text in the name field. Which may or may but be a good idea, don't know. If you really want that, you can do so manually, either in a subclass of JFileChooser or in a PropertyChangeListener, here's an override:
fc = new JFileChooser() {
@Override
public void setSelectedFile(File file) {
super.setSelectedFile(file);
((BasicFileChooserUI) getUI()).setFileName(getName(file));
}
};
fc.setFileView(new MyView());
Edit
outch ... hadn't expected so much mis-behaviour of the ui :-( Problem is that all the actions re-create a file object based on the content of the textField (instead of using the selectedFile property of the chooser) Now if that string has the extension trimmed, the file isn't found. The only way out would be to replace the actions ... which might not work.
In summary, this answer is useless, sorry.