I developed a program to draw polygon triangles. The triangles were drawn using mouse drag. The coordinate of the triangles were stored in array list. Every times the mouse cursor, mouse over on the existing drawn triangles(within the area of triangle), the mouse cursor should turns to "CROSSHAIR_CURSOR", however this were not happened. Help :-(
   ...
    public class DrawingBoardWithMatrix extends JFrame {
      public static void main(String[] args) {
        new DrawingBoardWithMatrix();
      }
    public DrawingBoardWithMatrix(){  
      this.add(new PaintSurface(), BorderLayout.CENTER);
      ... 
    }
    private class PaintSurface extends JComponent {
      java.util.List<Polygon> triangles = new LinkedList<Polygon>();
      Point startDrag, endDrag, midPoint;
      Polygon triangle;
      public PaintSurface() {   
      ... 
      this.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
          startDrag = new Point(e.getX(), e.getY());
          endDrag = startDrag;
          repaint();
        }//end mousePressed   
        public void mouseReleased(MouseEvent e) {
          if (startDrag.x > endDrag.x)
            midPoint = new Point((endDrag.x +(Math.abs(startDrag.x - endDrag.x)/2)),e.getY());
          else 
           midPoint = new Point((endDrag.x -(Math.abs(startDrag.x - endDrag.x)/2)),e.getY()); 
          int[] xs = { startDrag.x, endDrag.x, midPoint.x };
          int[] ys = { startDrag.y, startDrag.y, midPoint.y };      
          triangles.add( new Polygon(xs, ys, 3));    
          startDrag = null;
          endDrag  = null;
          repaint();
        }//end mouseReleased              
      });//end addMouseListener
      this.addMouseMotionListener(new MouseMotionAdapter() {
        public void mouseDragged(MouseEvent e) {
          endDrag = new Point(e.getX(), e.getY());
          repaint();
        }//end mouseDragged     
      });//end this.addMouseMotionListener
    }//end paintSurface       
    //THIS CODE DOESNT WORK - AND I AM STUCK :-(       
    public void mouseMoved(MouseEvent e) {
      startDrag = new Point(e.getX(), e.getY());
      if (triangles.contains(startDrag))
         setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
      else
         setCursor(Cursor.getDefaultCursor());
    }// end mouseMoved
     private void paintBackground(Graphics2D g2){
     ...
     }
     public void paint(Graphics g) {
     ...
     }
    }//end private class PaintSurface
    }//end public class DrawingBoardMatrix