By Alvin Alexander. Last updated: May 21, 2020
As a quick note to self, this is how you add an ActionEvent EventHandler
to a MenuItem in JavaFX, when writing JavaFX code in Scala:
menuItem.setOnAction(new EventHandler[ActionEvent]() { @Override def handle(e: ActionEvent) { println("put your action here ...") } })
If you have a reference to a MenuItem
named menuItem
, all you have to do now is implement the handle
method.