Why does my MouseListener not increment a variable in sequential order?
问题 In my Class X I have extended JPanel and implemented MouseListener , MouseMotionListener int numPoints = 0; Point controlPoints[] = new Point[10]; public void MousePressed (MouseEvent arg0) { if (numPoints < 5) controlPoints[numPoints] = arg0.getPoint(); numPoints++; } * When I System.out.println(numPoints); * output after 3 CLICKS; 0 0 2 2 3 3 5 WHY Does it not INCREMENT by 1, 2 ,3 ??? output (for numPoints) (first mouseclick) 1 2 ***I will provide more information if necessary. Thanks for