import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Button extends JApplet implements ActionListener
{
FlowLayout flow = new FlowLayout();
JButton pressMe = new JButton("Press Me");
JLabel iSawThat = new JLabel("Go ahead, press the button.");
public void init()
{
Container con = getContentPane();
con.setLayout(flow);
con.add(pressMe);
con.add(iSawThat);
pressMe.addActionListener(this);
}
public void actionPerformed(ActionEvent thisEvent)
{
iSawThat.setText("Button was pressed.");
repaint();
}
}