JAVAFX button action to call a function of other class
java, javafx
Solution
With Java 8:
button.setOnAction(e -> anInstanceOfYourOtherClass.yourMethod());
Prior to Java 8:
button.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent event) {
anInstanceOfYourOtherClass.yourMethod();
}
});
Problem
I am creating a project using javafx. I am using netbeans IDE. I had created many classes. When a button is pressed, a function from other class has to be worked. How to make it working ?