I\'m developing a JavaFX8 application in Scala but I couldn\'t figure out how to pass a method reference to an event handler. To clarify, I\'m not using ScalaFX library but
You should pass function which applying one parameter of type ActionEvent:
val button = new Button()
val inputController = new InputController()
def handler(h: (ActionEvent => Unit)): EventHandler[ActionEvent] =
new EventHandler[ActionEvent] {
override def handle(event: ActionEvent): Unit = h(event)
}
button.setOnAction(handler(inputController.handleFileSelection))