import java.awt.*; import java.awt.event.*; public class GUI extends Frame implements ActionListener { private Button button = new Button("Press Me"); public GUI() { setSize(300,300); setLocation(300,300); button.addActionListener(this); add(button, BorderLayout.SOUTH); setVisible(true); } public void actionPerformed(ActionEvent ae) { button.setLabel("Pressed"); } public static void main (String args[]) { new GUI(); } }