  // A Swing Image Button Application

  import javax.swing.*;
  import java.awt.*;
  import java.awt.event.*;

  public class SwingImageButton extends JFrame implements ActionListener
  {
	
	private JButton button1, button2;
	private JTextField status;
	
	public SwingImageButton() 
	{
	  // call the parent class constructor - sets the frame title
	  super("Swing Button Example");

	  Image tempImage = this.getToolkit().getImage("next.gif");
	  ImageIcon icon = new ImageIcon(tempImage);

	  this.status = new JTextField(20);
	  this.button1 = new JButton("Image Button 1",icon);
	  this.button2 = new JButton("Image Button 2",icon);

	  this.button1.addActionListener(this);
	  this.button2.addActionListener(this);

	  // default layout is border layout for frame/jframe
	  this.getContentPane().add("North",this.status);
	  this.getContentPane().add("Center",this.button1);
	  this.getContentPane().add("South",this.button2);

	  this.pack();  //set the size of the frame according 
			//to the component's preferred sizes
	  this.show();	//make the frame visible
	}
	
	public void actionPerformed(ActionEvent e)
	{
	  if (e.getSource().equals(button1))
	  {
	    this.status.setText("Button 1 Pressed");
	  }
	  else if (e.getSource().equals(button2))
	  {
	    status.setText("Button 2 Pressed");
	  }
	}

	public static void main(String args[])
	{
	   new SwingImageButton();
	}
  }
