List of usage examples for java.awt Window dispatchEvent
public final void dispatchEvent(AWTEvent e)
From source file:Main.java
public static void closeWindow(Window window) { window.dispatchEvent(new WindowEvent(window, WindowEvent.WINDOW_CLOSING)); }
From source file:com.limegroup.gnutella.gui.GUIUtils.java
/** * Returns (possibly constructing) the ESC action. *//*from ww w.ja va2 s .c om*/ public static Action getDisposeAction() { if (ACTION_DISPOSE == null) { ACTION_DISPOSE = new AbstractAction() { /** * */ private static final long serialVersionUID = 3219036624812939826L; public void actionPerformed(ActionEvent ae) { Window parent; if (ae.getSource() instanceof Window) parent = (Window) ae.getSource(); else parent = SwingUtilities.getWindowAncestor((Component) ae.getSource()); if (parent != null) parent.dispatchEvent(new WindowEvent(parent, WindowEvent.WINDOW_CLOSING)); } }; } return ACTION_DISPOSE; }