I\'m making a MenuBar, and I wan\'t the functionality to press a Menu like: \"File\" and then execute a action. Such like opening an other fxml, or
Recently i had the same problem, this is what i did
@FXML private Menu myMenu;
@Override
public void initialize(URL url, ResourceBundle rb) {
myMenu.setGraphic(
ButtonBuilder.create()
.text("btnText")
.onAction(new EventHandler(){
@Override public void handle(ActionEvent t) {
//TODO
} })
.build()
);
}