orig synopsis: "WindowEvents not delivered to FileDialog"
Name: mc57594 Date: 01/29/97
import java.awt.*;
import java.awt.event.*;
//Show's bug in FileDialog implementation of Dialog, or something like
that.
//Can't get WindowEvents to be delivered to a WindowListener w/the
FileDialog,
//but events seem to be delivered no problem to a basic Dialog.
//from: Scott McMullan (###@###.###)
public class DialogTest extends Frame {
FileDialog fd;
Dialog d;
public DialogTest() {
super("Dialog Test");
show();
//NO WindowEvents get delivered to fd's WindowListener
fd = new FileDialog(this, "Test FileDialog");
fd.addWindowListener(new FdListener());
fd.show();
//WindowEvents DO get delivered to d's WindowListener (eg.,
close the dialog)
d = new Dialog(this, "Test Dialog");
d.addWindowListener(new FdListener());
d.add(new Button("Fill Up Space Button"));
d.resize(100, 100);
d.show();
}
public static void main(String argv[]) {
DialogTest dt = new DialogTest();
}
}
//class FdListener extends WindowAdapter { <-- this doesn't work
either...
class FdListener implements WindowListener {
public FdListener() {
System.out.println("new FdListener being created...");
}
public void windowActivated(WindowEvent we) {
System.out.println("windowActivated()...");
}
public void windowClosing(WindowEvent we) {
System.out.println("windowClosing()...");
}
public void windowClosed(WindowEvent we) {
System.out.println("windowClosed()...");
}
public void windowIconified(WindowEvent we) {
System.out.println("windowIconified()...");
}
public void windowDeiconified(WindowEvent we) {
System.out.println("windowDeiconified()...");
}
public void windowDeactivated(WindowEvent we) {
System.out.println("windowDeactivated()...");
}
public void windowOpened(WindowEvent we) {
System.out.println("windowOpened()...");
}
}