У меня есть 3 ToggleGroups
, что мне нужно приложить к TextField
, так что TextField
дисплей соответствующее количество каждый раз, когда ToggleGroup
изменения свойств. первый я добавил слушатель к каждому ToggleGroup
как тоJavaFX изменение значения TextField, когда тумблер группа меняет
int f; //to calculate the first property condition
group1.selectedToggleProperty().addListener((v, oldValue, newValue) -> {
if (group1.getSelectedToggle() != null) {
//call a method which test the radioButtons to give the value to each one
f = testChoix(rdF1, rdF2, rdF3, rdF4);
}
});
Затем я добавил слушатель к TextField
txtCriticite.textProperty().addListener((observable, oldValue, newValue) -> {
calculCriticite();//method to calculate
});
//method to calculate the textField Value
public void calculCriticite() {
int c = f * g * d;
txtCriticite.setText(String.valueOf(c));
}
при компиляции и нажав на RadioButtons
, я не вижу любой текст в моем TextField
спасибо большое @ user7291698, он работает – devhicham