Słuchacz akcji dla przycisku, aby zamknąć Java Window
frame.dispatchEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING));
Energetic Eland
frame.dispatchEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING));