ouvinte de ação para o botão para fechar a janela java
frame.dispatchEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING));
Energetic Eland
frame.dispatchEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING));