Pages

Subscribe:

Blogger templates

Sample Text

Total Pageviews

Followers

About Us

My Photo
MY Name is Vicky. I am student in Univercity.Programming and webdesigning but i don't like Maths.Someone should kill the teacher .Besides i like writing stories ,and sciencefiction scripts .Soon i will have my book and a movie !!Like so much cooking & travelling all over the world an learn about other cultures! An artistic kid and art is my breath !

Thursday, July 16, 2009

LIST OF NAMES AND SHOW IN A TEXTFIELD

import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
public class showChoice extends Applet implements
ItemListener{
private Choice names;
private TextField tf;
String s;
public void init()
{
names=new Choice ();
names.add("Giorgos");
names.add("Kwstas");
names.add("Giannis");
names.add("Dimitra");
names.add("Balia");
add(names);
names.addItemListener(this);
tf=new TextField(names.getItem(0),20);
tf.setEditable(false);
add(tf);
}
public void itemStateChanged(ItemEvent e)
{
s=(String) e.getItem();
tf.setText(s);
}
}

0 comments:

Post a Comment