=Gestion Ventana.java =
1
2 /**
3 *@ Andrea Forero andreita_9009@hotmail.com
4 *@ Claudia Leon claudialeon18@hotmail.com
5 *@ Erika Santana eesantana61@hotmail.com
6 **/
7
8
9
10 import java.awt.event.WindowEvent;
11 import java.awt.event.WindowListener;
12 import java.io.FileNotFoundException;
13 import java.io.FileOutputStream;
14 import java.io.IOException;
15 import java.io.ObjectOutputStream;
16 import java.util.ArrayList;
17 import java.util.Iterator;
18
19
20 public class GestionVentana implements WindowListener{
21 public ArrayList listaPuntajes;
22 public GestionVentana(ArrayList listaPuntajes){
23 this.listaPuntajes=listaPuntajes;
24 }
25 public void windowClosing(WindowEvent arg0) {
26 try {
27 for(Iterator iter = listaPuntajes.iterator();iter.hasNext();){
28 Puntaje p = (Puntaje)iter.next();
29 System.err.println(p.getNombre()+"\t"+ p.getCantidad());
30 }
31
32 ObjectOutputStream archivo= new ObjectOutputStream(new FileOutputStream(Constantes.nombreArchivo));
33 archivo.writeObject(listaPuntajes);
34 archivo.close();
35
36 } catch (FileNotFoundException e) {
37 System.err.println("Archivo no encontrado" );
38 e.printStackTrace();
39 }
40 catch (IOException e) {
41 System.err.println("Error de entrada/salida");
42 e.printStackTrace();
43 }
44
45 System.exit(0);
46
47 }
48 public void windowActivated(WindowEvent arg0) {
49 // TODO Auto-generated method stub
50
51 }
52 public void windowClosed(WindowEvent arg0) {
53 // TODO Auto-generated method stub
54
55 }
56 public void windowDeactivated(WindowEvent arg0) {
57 // TODO Auto-generated method stub
58
59 }
60 public void windowDeiconified(WindowEvent arg0) {
61 // TODO Auto-generated method stub
62
63 }
64 public void windowIconified(WindowEvent arg0) {
65 // TODO Auto-generated method stub
66
67 }
68 public void windowOpened(WindowEvent arg0) {
69 // TODO Auto-generated method stub
70
71 }
72
73 }
74
75
CategoryJava | CategoryProgramacion
