I want to call my method in fxml file after user click on text field, but see exception:

Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: argument type mismatch

My fxml tag:

<TextField fx:id="userId"  onMouseClicked="#processEnter" />

What can I do?

有帮助吗?

解决方案

Make sure the parameter type for processEnter(...) is MouseEvent, and that you have the correct import in the controller: javafx.scene.input.MouseEvent, not the awt version.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top