I have mouseMotionListener in my jpanel code.
But how can I know if the mouse dragged to left or right inside the jpanel?
Use
if (currentX > previousX) {
// Right
} else {
// Left
}
previousX = currentX;
in your listener.
Hope this helps.