-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.3.0
-
x86
-
linux
Name: stC104175 Date: 07/20/2000
ava version "1.3.0beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0beta-b07)
Java HotSpot(TM) Client VM (build 1.3.0beta-b04, mixed mode)
use the FileDialog with a FilenameFilter.
when the dialog initially appears, the filter works fine.
change the directory in the dialog by double clicking on a directory in the
left pane. after the directory changes, the filename filter no longer works.
for example, if you compile and run the following program, you will initially
see any java files that you have in the current directory.
if you change the directory, then you will see all files,
even though the filter specifies that only java files should be displayed.
import java.awt.Frame;
import java.awt.FileDialog;
import java.io.File;
import java.io.FilenameFilter;
public class FileDlg extends Frame
{
public static void main(String[] args)
{
new FileDlg();
}
public FileDlg()
{
setBounds(100,100,100,100);
show();
FileDialog dlg = new FileDialog(this, "select", FileDialog.LOAD);
dlg.setFilenameFilter(new FileFilter());
dlg.show();
dispose();
System.exit(0);
}
public class FileFilter implements FilenameFilter
{
public boolean accept(File dir, String name)
{
return name.endsWith( ".java" );
}
}
}
(Review ID: 106622)
======================================================================
- duplicates
-
JDK-4293697 FileDialog filter does not work on Solaris in directory traversal
-
- Resolved
-