There are several buttons recorded in an FXML file, and all of them are given onAction = "setWall"

How do you press a button when pressing any of the buttons?

  • Lattice "#" is onAction = "#setWall" : onAction = "#setWall" - oshatrk

1 answer 1

So:

 public void setWall(ActionEvent actionEvent) { if (actionEvent.getSource() instanceof Button) { Button button = (Button) actionEvent.getSource(); } } 
  • I messed up the Event, changed it. - BigTows