I have an FXML file that has buttons with onMouseClicked attributes. I do not set a Controller up in the FXML because I have constructor injected data I want to provide to t
You need to add top level element fx:controller.
Lets say you have a basic fxml file with a just anchor pane with a button like the fxml below.
Your top level element will be the anchor pane in this case. If you want to use action buttons like onMouseClicked you need to tell to fxml you controller class in your top level element (in this case anchor pane) like below.
fx:controller="com.example.Controller" line says that my control class is Controller which is in the com.example package.
Also your elements id's should begin with fx like in the example (fx:id="buttonExample").