I made ChoiceBox
, but a problem occurs; when I leave the stage and then return, the ChoiceBox
continues with the previously chosen item. I want it to come out and then return, it goes back to the initial state, that is, with no chosen item.
How to do this? Look at part of the code:
cb.getSelectionModel().selectedIndexProperty().addListener((ObservableValue<? extends Number> obs, Number old , Number newValue)->{
switch(newValue.intValue()){
case 0:
validarSemChoiceBox = true;
nivelDaTarefa = fonemas;
new TictactoeViewController().limparJogo();
break;
case 1:
validarSemChoiceBox = true;
nivelDaTarefa = silabas;
new TictactoeViewController().limparJogo();
break;
case 2:
validarSemChoiceBox = true;
nivelDaTarefa = palavras;
new TictactoeViewController().limparJogo();
break;
}
});