Home > OS >  JavaFX mouse event
JavaFX mouse event

Time:03-28

I am using a JavaFX with Java 8 to make a copy of simple 2d Flash Player-game. I noticed that click event is called when you leave mouse button not when you are pressing it. Is there a way to fix this? Thanks. Windows 10 x64

CodePudding user response:

No, you can only fix things which are broken but this is by design. How shall the system know that you have clicked on something before you release the mouse button? The first mouse press could also be the start of a drag. Look at the documentation: https://docs.oracle.com/javase/8/javafx/api/javafx/scene/input/MouseEvent.html#MOUSE_CLICKED Depending on your use-case you might use the mouse pressed event instead. https://docs.oracle.com/javase/8/javafx/api/javafx/scene/input/MouseEvent.html#MOUSE_PRESSED

  • Related