List of usage examples for java.awt.event WindowEvent WINDOW_GAINED_FOCUS
int WINDOW_GAINED_FOCUS
To view the source code for java.awt.event WindowEvent WINDOW_GAINED_FOCUS.
Click Source Link
From source file:Main.java
protected void processWindowEvent(WindowEvent e) { if (e.getID() == WindowEvent.WINDOW_GAINED_FOCUS) { System.out.println(WindowEvent.WINDOW_GAINED_FOCUS); dispose();/*from ww w.jav a 2 s .c o m*/ System.exit(0); } super.processWindowEvent(e); // Pass on the event }