'How to change the cursor type

This question is related to the previous post. How to save file and read

alt text http://freeimagehosting.net/image.php?dc73c3bb33.jpg

How can I change the cursor to "Hand" only when the mouse pointed on grid which is not Null (contained images)?

So far the cursor turn to "Hand" all over the grids (null or not null).

public GUI() {
....
  JPanel pDraw = new JPanel();
  ....
  for(Component component: pDraw.getComponents()){
     JLabel lbl = (JLabel)component;

     //add mouse listener to grid box which contained image
     if (lbl.getIcon() != null)
        lbl.addMouseListener(this);
  }

  public void mouseEntered(MouseEvent e) {
     Cursor cursor = Cursor.getDefaultCursor();
     //change cursor appearance to HAND_CURSOR when the mouse pointed on images
     cursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); 
     setCursor(cursor);
  }


Solution 1:[1]

Here is one way of changing the cursor at a particular column in JTable:

if(tblExamHistoryAll.columnAtPoint(evt.getPoint()) == 5)
{
     setCursor(Cursor.HAND_CURSOR);
}
else
{
     setCursor(0);
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 BeRecursive