Exemplo simples de Eventos import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JFrame; import javax.swing.JPanel; public class LabelTest extends JFrame{ public LabelTest(String titulo){ super(titulo); setSize(250, 200); addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e){ System.exit(0); } }); }
{}