// A Swing ToolTips Button Application

  import javax.swing.*;
  import javax.swing.border.*;
  import java.awt.*;
  import java.awt.event.*;

  public class SwingExtras extends JFrame implements ActionListener
  {
	
	private JButton button1, button2;
	private JTextField status;
	
	public SwingExtras()
	{
	  // 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);

	  EmptyBorder eborder = new EmptyBorder(5,5,5,5);	
	  MatteBorder mborder = new MatteBorder(10,10,10,10,Color.black);
	  LineBorder lborder = new LineBorder(Color.black, 5, true);

	  this.status = new JTextField(20);
	  this.status.setBorder(mborder);         

	  this.button1 = new JButton("Image Button 1",icon);
	  this.button1.setToolTipText("Press this Button to Display Button 1 Information");
	  this.button1.setBorder(eborder);
	  
	  this.button2 = new JButton("Image Button 2",icon);
	  this.button2.setToolTipText("Press this Button to Display Button 2 Information");
	  this.button2.setBorder(lborder);

	  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 SwingExtras();
	}
  }
