WindowEvent example
import java.awt.*;
import java.awt.event.*;
public class TestWindowEvent extends Frame implements WindowListener
{
public TestWindowEvent() {
setSize(400,500);
setVisible(true);
this.addWindowListener(this);
}
public void windowDeactivated(WindowEvent we) {
System.out.println("Deactivated" );
}
public void windowActivated(WindowEvent we) {
System.out.println("Activated" );
}
public void windowDeiconified(WindowEvent we) {
System.out.println("Deiconifid" );
}
public void windowIconified(WindowEvent we) {
System.out.println("Iconified" );
}
public void windowClosed(WindowEvent we) {
System.out.println("Closed" );
}
public void windowOpened(WindowEvent we) {
System.out.println("Opened" );
}
public void windowClosing(WindowEvent we) {
System.exit(0);
}
public static void main(String args[]) {
new TestWindowEvent();
}
}
import java.awt.event.*;
public class TestWindowEvent extends Frame implements WindowListener
{
public TestWindowEvent() {
setSize(400,500);
setVisible(true);
this.addWindowListener(this);
}
public void windowDeactivated(WindowEvent we) {
System.out.println("Deactivated" );
}
public void windowActivated(WindowEvent we) {
System.out.println("Activated" );
}
public void windowDeiconified(WindowEvent we) {
System.out.println("Deiconifid" );
}
public void windowIconified(WindowEvent we) {
System.out.println("Iconified" );
}
public void windowClosed(WindowEvent we) {
System.out.println("Closed" );
}
public void windowOpened(WindowEvent we) {
System.out.println("Opened" );
}
public void windowClosing(WindowEvent we) {
System.exit(0);
}
public static void main(String args[]) {
new TestWindowEvent();
}
}
Comments
Post a Comment