There are many objects of one class on the screen. Determine when the mouse pointer is over each object or leave its problems is not - setOnMouseEnter, etc. When the mouse button is pressed, these events are not sent. Are there any non-hardcore ways to track the movement of the mouse over objects with the button pressed?
1 answer
There is a standard method interface MouseMotionListener
Code snippet:
// обработка события "перемещения мыши" public void mouseMoved(MouseEvent me) { // TODO: System.out.pringln("Moving mouse at " + me.getX() + ", " + me.getY()); System.out.pringln("Component: "me.getComponent()); System.out.pringln("Source: "me.getSource()); // } - Thanks for the answer, but did not understand anything, to be honest. Apparently because I forgot to mention - everything happens in javaFX. - Spooner
|