-
Bug
-
Resolution: Fixed
-
P4
-
6
-
b02
-
x86
-
windows
-
Verified
namefilter is not called for file dialog on windows if it is set before creating file dialog's
peer.
Here is the test:
import java.awt.Frame;
import java.awt.FileDialog;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.FilenameFilter;
public class filter_test {
private static volatile boolean accept_file = false;
public static void main(String[] args) {
Frame frame = new Frame("filter test");
frame.setSize(100, 100);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
we.getWindow().dispose();
}
});
frame.setVisible(true);
FileDialog fd = new FileDialog(frame, "hello world", FileDialog.LOAD);
// fd.pack();
fd.setFilenameFilter(new FilenameFilter() {
public boolean accept(File dir, String name) {
accept_file = !accept_file;
System.out.println(Thread.currentThread() + " name = " + name + ", accept = " + accept_file);
return accept_file;
}
});
fd.setDirectory("c:\\download");
fd.setVisible(true);
}
}
if uncomment fd.pack() then filter is called
peer.
Here is the test:
import java.awt.Frame;
import java.awt.FileDialog;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.FilenameFilter;
public class filter_test {
private static volatile boolean accept_file = false;
public static void main(String[] args) {
Frame frame = new Frame("filter test");
frame.setSize(100, 100);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
we.getWindow().dispose();
}
});
frame.setVisible(true);
FileDialog fd = new FileDialog(frame, "hello world", FileDialog.LOAD);
// fd.pack();
fd.setFilenameFilter(new FilenameFilter() {
public boolean accept(File dir, String name) {
accept_file = !accept_file;
System.out.println(Thread.currentThread() + " name = " + name + ", accept = " + accept_file);
return accept_file;
}
});
fd.setDirectory("c:\\download");
fd.setVisible(true);
}
}
if uncomment fd.pack() then filter is called
- relates to
-
JDK-7149081 java/awt/FileDialog/FilenameFilterTest/FilenameFilterTest.html failed on solaris with jdk 7 64bit
-
- Open
-