Hi i was wondering if anyone can help me out. Im trying to make a applet when a button is clicked it will appear the name John . And when another button is pressed it will display "Smith" in a seperate text field. This is what I have so far.
import java.applet.*;
import java.awt.*;
public class Test extends Applet
{
Button first ;
Button last;
TextField one ;
TextField two ;
public void init ()
{
first = new Button;
last = new Button;
one = new TextField;
two = new TextField;
add (first);
add(last);
add(one);
add(two);
}
public boolean action (Event e , Object o)
{
if (e.target == first)
{
one.setText("john");
}
else if (e.target == last)
{
two.setText("smith");
}
}
}