Just like hardwired just said, the compiler might not give u an error by doing
public void mouseMove(MouseEvent e){
int x_pos=e.getX();
}
But u r declaring another x_pos in that mouseMove() method, in which the class variable x_pos must be refered as this.x_pos, not a very good on this context though
And btw, if im not mistaken, by implementing MouseMotionListener we must override the method mouseDraggeed() and mouseMoved right?
Just like hardwired just done there, if not the compiler would complain, maybe ur other listeners don't work because u didn't override the correct methods for that listener?