Here you can find the source of closeWindow(final JFrame frame)
static void closeWindow(final JFrame frame)
//package com.java2s; import javax.swing.JFrame; import java.awt.event.WindowEvent; public class Main { /**/*from w w w . j a v a 2s . com*/ * Send a {@link WindowEvent#WINDOW_CLOSING} event to the given window. */ static void closeWindow(final JFrame frame) { final WindowEvent ev = new WindowEvent(frame, WindowEvent.WINDOW_CLOSING); frame.dispatchEvent(ev); } }