0
How do I make a selection event from radioButton
be started by default ?
I determined that mine radios buttons
will call some methods when selected, I did within the initialize
, however, the way this is, I have to click on the radio for it to perform, as I do, so that it already fires the event ? I have already tried to give a radio01.setSelected(true);
but it only marks the radio and does not trigger the event.
public void initialize(URL location, ResourceBundle resources) {
fisica.setSelected(true);
radio01.selectedProperty().addListener((p, ov, nv) -> {
//metódos
});
radio02.selectedProperty().addListener((p, ov, nv) -> {
//metódos
});
}
If it will run without having to select the radio button then why put it as a select radio button event? Could not only without a normal boot event?
– Anderson Henrique
@Andersonhenrique he will change the components of the screen, he has to have event, because when selecting Radio2 will change the screen, without the event can not switch the screen by radio
– G1Win
Leaves the events and changes the screen on startup
– Anderson Henrique
There’s no other way, I’m changing the components on the screen, if it’s radio 1, it’s determined field, if it’s radio 2, it’s other fields.
– G1Win
tries using bind().
– Julio Cesar
@Juliocesar could give me an example ?
– G1Win
in this example the button will be
disable
depending on whether or not the tableView contains data.btnSave.disableProperty().bind(Bindings.isEmpty(tbView.getItems()));
– Julio Cesar