/**********************************************************
A JApplet illustrating the most basic possible use of
Swing.
Features shown here will be explained in lecture.
Jim Henry 9/7/04
**********************************************************/
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class HelloSwing0 extends JApplet implements ActionListener
{
Container contentPane;
JButton b;
JTextField tf;
public void init()
{
contentPane = getContentPane();
contentPane.setLayout(new FlowLayout());
b = new JButton("Press Me");
tf = new JTextField(25);
contentPane.add(b);
contentPane.add(tf);
b.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
tf.setText("Button pressed");
}
}