Hi Konny,
Use FileDialog.setFilenameFilter(java.io.FilenameFilter). FilenameFilter is
an interface that only has one method to override, accept(File dir, String
name). Create a class that inplements this interface, and add an accept()
method. Check for something like name.endsWith("html"), and use this to
only display the files you want to see.
If you are doing any Swing development, look into the JFileChooser
component. JFileChooser has more choices for setting the filter; you can
set multiple filters, and each one will appear nicely in the drop-down
list. JFileChooser is much nicer, in my opinion.
Chris Allen
Internet Tools Tech. Support
Symantec Corp.
setFilenameFilter in openFileDialog does not work at all.
First, debug shows that if no peer exists, setFilenameFilter just
exits. However, once the dialog has been made visible once, it makes
the call to its peer, but it still doesn't work:
The "accept" method is never called as determined by setting a
breakpoint in it.
Any clues as to why this does not work? Using VCafe 3.0c
Professional Edition.
I suggest that you post a question on one of the comp.lang.java
newsgroups (which is a standard USENET newsgroup). Also, you can go
to Sun's web site at www.javasoft.com for another resource concerning
Java programming issues.
Regards,
Tim Dutton
Internet Tools Technical Support
Symantec Corporation