//HelloUser.java //Illustrates text input and output //Andy Harris, 05/00 import java.awt.*; import java.applet.*; import java.awt.event.*; public class HelloUser extends Applet implements ActionListener{ TextField txtInput = new TextField(); Label lblOutput = new Label(); Button btnOK = new Button("OK"); public void init(){ setLayout(new GridLayout(0,1)); Panel pnlButton = new Panel(); pnlButton.setLayout(new FlowLayout()); pnlButton.add(btnOK); add(new Label("Enter your name and press the button")); add(txtInput); add(pnlButton); add(lblOutput); btnOK.addActionListener(this); } // end init public void actionPerformed(ActionEvent e){ String output = "Hi there, "; output += txtInput.getText(); output += "!"; lblOutput.setText(output); } // end actionPerformed } //end class def