C
Normally, all the behavior of the program is determined by its code written on Java. FXML files usually only determine the appearance of the window, but not its behaviour. In order for the programme to be able to respond to the user ' s actions, the elements of the interface (boxes, input elements, etc.) need to be linked to the so-called " listeners " , or, in other words, processors for all types of events to be processed (compression, focus of entry, etc.). The listener (listener) is a fragment of the software code that will be implemented when the event occurs. In the simplest case, it might look like, myButton.setOnAction(e -> System.out.println("Нажата кнопка "
+ ((Button)(e.getSource())).getText()));
Here with the button. myButton connecting a listener to a type event ActionEventwhich will be educated by a button when compressed. In this fragment of the circumference containing information on the event presented in the code ethe element of the interface that caused the event is extracted.e.getSource()(in this case, it will be the ea button itself) and its text shall be inserted into the console.In some cases, the event processors may be added directly to the FXML file (see nap. http://tutorials.jenkov.com/javafx/fxml.html Paragraph FXML Event HandlersBut that's the practice, I'd say, of amateur.