Changing the image on a JLabel when mouse moves over it

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
 
public class ChangeIconJLabel extends JFrame{
 
   private JLabel label;
   private JPanel panel;
 
   public ChangeIconJLabel() {
      super("ChangeIconJLabel Example");
      panel = new JPanel(new GridLayout(3,0));
	
      //enter your image here            |
      //			        |/
      label = new JLabel(new ImageIcon("10.gif"));
				
      panel.add(label);
 
      label.addMouseListener(new MouseAdapter() {
         //when mouse entered the label set new Icon
         public void mouseEntered(MouseEvent evt) {
            label.setIcon(new ImageIcon("2.gif"));
         }
         //when mouse exited the label set old Icon
         public void mouseExited(MouseEvent mevt) {
            label.setIcon(new ImageIcon("10.gif"));
         }
      });		
				
      addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent event) {
            dispose();
            System.exit(0);
         }
      });
   
      setContentPane(panel);
      setSize(300,100);
      setVisible(true);
   }
 
   public static void main(String args[]) {
      ChangeIconJLabel j = new ChangeIconJLabel();
   }
}