import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class talk1 extends Applet { ActionTextField TextField1; TextField TextField2; ActionButton Button1; public void init() { TextField1= new ActionTextField(); TextField2=new TextField(); Button1 =new ActionButton("Press Me"); // "The Applet panel" setLayout(new BorderLayout()); add("North",TextField1); add("South",Button1); add("Center",TextField2); Button1.addActionListener(Button1); Button1.addActionListener(TextField1); }//init class ActionTextField extends TextField implements ActionListener{ public void actionPerformed(ActionEvent evt){ TextField2.setText(TextField1.getText()); TextField1.setText(""); } }//end of ActionTextField class ActionButton extends Button implements ActionListener{ public ActionButton(String s){ super(s);} public void actionPerformed(ActionEvent evt){ String hold=getLabel(); setLabel("Button was Pressed!"); try{Thread.currentThread().sleep(2000);} catch(InterruptedException e){} setLabel(hold); } }//end of ActionButton }//end of class