import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
/*<applet code=scrolllist.class width=350 height=400></applet>*/
public class scrolllist extends Applet implements ActionListener
{
List list1;
TextField text1;
public void init()
{
text1=new TextField(20);
add(text1);
list1=new List(2,true);
list1.add("sudhir");
list1.add("sateesh.bagadhi");
list1.add("Paru");
add(list1);
list1.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==list1)
{
text1.setText(((List)e.getSource()).getSelectedItem());
}
}
}
No comments:
Post a Comment