I wrote some code in my project, and I found that I should put my buttonlistener in the public void initialize()
, or I can't use the button. I don't know what the initialize() mean in javafx , why I can't change it to another method name?
This is initialize method in my code, I don't implement Initializable. So what't the mean of this in javafx?
public void initialize() {
weight_number1.setOnAction(e -> number(1));
weight_number2.setOnAction(e -> number(2));
weight_number3.setOnAction(e -> number(3));
weight_number4.setOnAction(e -> number(4));
weight_number5.setOnAction(e -> number(5));
weight_number6.setOnAction(e -> number(6));
weight_number7.setOnAction(e -> number(7));
weight_number8.setOnAction(e -> number(8));
weight_number9.setOnAction(e -> number(9));
weight_number0.setOnAction(e -> number(0));
weight_numberCE.setOnAction(e -> symbol(1));
weight_numberLeft.setOnAction(e -> symbol(2));
weight_numberp.setOnAction(e -> symbol(3));
weight_box1.setOnAction((event) -> {
change();
showans();
});
weight_box2.setOnAction((event) -> {
change();
showans();
});
}