ActionEvent get source of button JavaFX -
i have 10 buttons going sent same method. want method identify source. method knows button "done" has evoked function. can add switch case of if statement handle them accordingly. have tried //call: btndone.setonaction(e -> test(e)); public void test(actionevent e) { system.out.println("action 1: " + e.gettarget()); system.out.println("action 2: " + e.getsource()); system.out.println("action 3: " + e.geteventtype()); system.out.println("action 4: " + e.getclass()); } output result: action 1: button@27099741[styleclass=button]'done' action 2: button@27099741[styleclass=button]'done' action 3: action action 4: class javafx.event.actionevent done text on button. can see use e.gettarget() and/or e.getsource() i'll have substring it, "done" appears. there other way string in apostrophe instead of having substring. update: have tried passing butt...