get button content mouse listener event java code example
Example: java mouseevent
public void mouseDragged(MouseEvent e) {
mouseX = e.getX();
mouseY = e.getY();
if (SwingUtilities.isLeftMouseButton(e)) {
mouseB = 1;
}
if (SwingUtilities.isRightMouseButton(e)) {
mouseB = 3;
}
MouseDraggedEvent event = new MouseDraggedEvent(e.getX(), e.getY(), mouseB);
try {
eventListener.onEvent(event);
} catch (Exception ex) {}
}