My favorites
▼
|
Sign in
lineadecodigo
Web Code Samples in spanish
Project Home
Downloads
Wiki
Issues
Source
Checkout
Browse
Changes
Source path:
svn
/
trunk
/
lineadecodigo_java
/
src
/
com
/
lineadecodigo
/
java
/
swing
/
CerrarVentana.java
r478
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.lineadecodigo.java.swing;
/**
* @file CerrarVenatana.java
* @version 1.0
* @author Linea de Codigo (http://lineadecodigo.com)
* @date 4-junio-2010
* @url http://lineadecodigo.com/java/cerrar-una-ventana-con-java-swing/
* @description Gestionar el cierre de una ventana en Java Swing
*/
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class CerrarVentana extends JFrame {
private static final long serialVersionUID = 1L;
public CerrarVentana(){
super("Hola Mundo");
JLabel label = new JLabel("Hola Mundo");
getContentPane().add(label);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.out.println("adios");
System.exit(0);
}
});
setSize(200,100);
setVisible(true);
}
public static void main(String[] args) {
new CerrarVentana();
}
}
Show details
Hide details
Change log
r254
by vcuervo on Jun 4, 2010
Diff
Cerrar ventana en Java Swing
Go to:
...go/java/swing/CerrarVentana.java
Project members,
sign in
to write a code review
Older revisions
All revisions of this file
File info
Size: 989 bytes, 45 lines
View raw file
Powered by
Google Project Hosting