Source Code : Demonstrating the WindowListener
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Demonstrating the WindowListener
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.JFrame;
public class WindowTest {
public static void main(String args[]) {
JFrame frame = new JFrame("Window Listener");
WindowListener listener = new WindowListener() {
public void windowActivated(WindowEvent w) {
System.out.println(w);
}
public void windowClosed(WindowEvent w) {
System.out.println(w);
}
public void windowClosing(WindowEvent w) {
System.out.println(w);
System.exit(0);
}
public void windowDeactivated(WindowEvent w) {
System.out.println(w);
}
public void windowDeiconified(WindowEvent w) {
System.out.println(w);
}
public void windowIconified(WindowEvent w) {
System.out.println(w);
}
public void windowOpened(WindowEvent w) {
System.out.println(w);
}
};
frame.addWindowListener(listener);
frame.setSize(300, 300);
frame.show();
}
}
Thank with us