MouseEvents not working in Java:
When I drag my mouse nothing happens. This program is supposed to draw while dragging.

Heres the main class:

```
public class GUI {

public static void main(String[] args) {

    simpledrawing xx = new simpledrawing();
    JFrame x = new JFrame();
    x.add(xx,BorderLayout.SOUTH);
    x.add(new JLabel("Drag to draw"),BorderLayout.NORTH);
    x.setSize(450,450);
    x.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    x.setVisible(true);
}

```

}

Heres the event listener class

```
public class simpledrawing extends JPanel{
private int pc =0;
private Point[] points = new Point[10000];

public simpledrawing(){
     System.out.print("Entered Constructor");
    addMouseMotionListener(
    new MouseMotionAdapter(){
     @Override   
    public void mouseDragged(MouseEvent e){
            System.out.print("Dragging Mouse");
            if(pc<points.length){
                points[pc] = e.getPoint();
                ++pc;
                repaint();
            }
        }
    });

  }

public void paintComponent( Graphics g )
{
    super.paintComponent( g );
    for( int i=0; i < pc; i++ )
    g.fillOval(points[i].x ,points[i].y , 4, 4);
}

```