Can't find a proper way to find the existing answers, so here is the sketch example describing my situation:
public class MyRButton {
RadioButton rb;
MyRButton (RadioButton _rb) {
rb = new RadioButton(_rb);
rb.setOnAction(this::handleSelectedAction);
}
handleSelectedAction(ActionEvent _selected) {
// DO if RadioButton rb is selected directly (by mouse etc.)
// Some external actions are able to reset isSelected() state of the
// RadioButton during action handling, so to make sure it's still
// selected after method processing:
rb.setSelected(true); // HERE IS THE DOUBT IF THIS OPERATOR CALLS
// handleSelectedAction(ActionEvent _selected) RECURSIVELY
}
}
Do I have to surround rb.setSelected(true) with disable/enable action handler instruction?
handleSelectedAction(ActionEvent _selected) {
// DO if RadioButton rb is selected directly (by mouse etc.)
rb.setOnAction(null);
rb.setSelected(true);
rb.setOnAction(this::handleSelectedAction);
}
Original code works well, but I suspect if the handleSelectedAction method is running on the background permanently.