Java Example Program/ Sample Source Code
import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.TextField;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
class WindowDeactivatedExample {
public static void main(String args[]) {
Frame frame = new Frame("WindowAdapterExample");
TextField textField = new TextField();
frame.add(textField, BorderLayout.NORTH);
frame.pack();
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
System.exit(0);
}
});
}
} |
|
|