Button b = new Button("Hello");
b.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
//something in response to click
}
});
Frame f = new Frame("Java Frame");
f.add(b, BorderLayout.NORTH );
f.pack();
f.show();
I would also suggest looking into SUN's documentation on actionListener interface and the Action Object.