I have a problem that is driving me crazy, i have a function which controls some electric lockers in my application, i wrote this function to display to the users the lockers that are open and the ones that are close, while he launch this function (through a button) i would show to the user a progress indicator and disable the pane where i have some buttons which represent the lockers (and each of these buttons open the right locker once clicked), but when i click the button to check the lockers it don't disable the HBox and don't set visible the ProgressIndicator, but it execute the part of code which controls the lockers here is the part of the code:
btnCheckSlides.setOnAction((ActionEvent event) ->{
piControlOnLockers.setVisible(true);//this is the progress indicator
hBoxButtonSlides.setDisable(true);//and this is the hbox
String slideOpen= returnOpenedSlides(drawer,Integer.parseInt(btnCheckSlides.getAccessibleText()));//function which gives me back the number of open lockers
if(slideOpen.isEmpty()==false){
String slidesOpen[] = slideOpen.split(";");
for(int k = 0; k< slidesOpen.length; k++){
System.out.print(Integer.parseInt(slidesOpen[k]));
for(int j = 0; j < mainList.get(Integer.parseInt(btnCheckSlides.getAccessibleText())).getChildren().size(); j++){
if(Integer.parseInt(slidesOpen[k]) == Integer.parseInt(mainList.get(Integer.parseInt(btnCheckSlides.getAccessibleText())).getChildren().get(j).getAccessibleHelp())-1){
mainList.get(Integer.parseInt(btnCheckSlides.getAccessibleText())).getChildren().get(j).getStyleClass().add("focus");
}
}
}
}
piControlOnLockers.setVisible(false);
hBoxButtonSlides.setDisable(false);
});
so once the h box is disabled and the pi is visible after the function which controls the lockers they became enable and not visible again
and i tried to comment the code between the initial and the final part like this and it works, i can't understand why a part of code like that is giving me all these problems
btnCheckSlides.setOnAction((ActionEvent event) ->{
piControlOnLockers.setVisible(true);//this is the progress indicator
hBoxButtonSlides.setDisable(true);//and this is the hbox
try{
Thread.sleep(5000); //to see if the box is disabled for 5 secs and the pi is set to visible
}catch(InterruptedException ex){
System.out.println(ex.toString());
}
piControlOnLockers.setVisible(false);//"hide" the pi again
hBoxButtonSlides.setDisable(false);//set the box enable again
});
P.S. i comunicato to the lockers through a TCP/IP board, but i think the problem is not there 'cause the function which control of the lockers works perfectly and gives me bad the exact number of the right lockers that are open