GestionVentana.java
1 /**
2 *@author Andres Felipe Quevedo vega. andresfe118@hotmail.com
3 */
4 import java.awt.event.WindowEvent;
5 import java.awt.event.WindowListener;
6 import java.io.FileNotFoundException;
7 import java.io.FileOutputStream;
8 import java.io.IOException;
9 import java.io.ObjectOutputStream;
10 import java.util.Vector;
11
12
13
14 public class GestionVentana implements WindowListener {
15 private Vector listaPuntajes;
16 public GestionVentana(Vector listaPuntajes){
17 this.listaPuntajes = listaPuntajes;
18 }
19 public void windowClosing(WindowEvent e){
20 try{
21 ObjectOutputStream archivo = new ObjectOutputStream(new FileOutputStream(Constantes.nombre_archivo));
22 archivo.writeObject(listaPuntajes);
23 archivo.close();
24
25 }
26 catch(FileNotFoundException e1){
27 e1.printStackTrace();
28 }
29
30 catch (IOException e1) {
31 e1.printStackTrace();
32 }
33 System.exit(0);
34 }
35 public void windowActivated(WindowEvent arg0) {
36 // TODO Auto-generated method stub
37
38 }
39 public void windowClosed(WindowEvent arg0) {
40 // TODO Auto-generated method stub
41
42 }
43 public void windowDeactivated(WindowEvent arg0) {
44 // TODO Auto-generated method stub
45
46 }
47 public void windowDeiconified(WindowEvent arg0) {
48 // TODO Auto-generated method stub
49
50 }
51 public void windowIconified(WindowEvent arg0) {
52 // TODO Auto-generated method stub
53
54 }
55 public void windowOpened(WindowEvent arg0) {
56 // TODO Auto-generated method stub
57
58 }
59
60 }
CategoryJava | CategoryProgramacion
