viernes, 15 de octubre de 2010

***LISTAS***

import java.awt.*;
import java.awt.event.*;

public class listas extends Frame
{

List lista=new List(0,true);
Label text=new Label("Alumnas");

public listas()
{
super("ELEGIR ALUMNO A EVALUAR");

lista.add("Eliana");
lista.add("Diana");
lista.add("mauricio");
lista.add("Bartolomeo");
lista.add("Marco");
lista.add("Montefalcone ");
lista.add("Sara");
lista.add("maria ");
lista.add("ana");
lista.add("juan ");


add(lista,BorderLayout.CENTER);
add(text,BorderLayout.SOUTH);

addWindowListener(new listeWindowListener());


setSize(350,100);

setResizable(false);

show();

}


public static void main(String [] arg)
{

new listas();

}


class listeWindowListener implements WindowListener
{

public void windowActivated(WindowEvent e)
{}

public void windowClosed(WindowEvent e)
{}

public void windowClosing(WindowEvent e)
{


String[] s=lista.getSelectedItems();
int i=0;
System.out.println(" ");
try
{
while (true)
{

System.out.println(s[i++]);

}

}
catch (ArrayIndexOutOfBoundsException er)
{System.out.println("Qué lo pases bien...");}
System.exit(0);
}

public void windowDeactivated(WindowEvent e)
{}

public void windowDeiconified(WindowEvent e)
{}

public void windowIconified(WindowEvent e)
{}

public void windowOpened(WindowEvent e)
{}

}



{



}

}

No hay comentarios:

Publicar un comentario