I have a label somewere in my code that is sometimes visible and sometimes not (to warn the player when he is about to overwrite a save file). To achieve this, I use label.setIsVisible(boolean). I’ve checked with System.println’s that the call is being recieved, and I’ve alse called System.out.println(lavel.getIsVisible());, to check what Tonegod thinks, and this is what I got:
When I open the menu after starting the game, then the window that is asking for confirmation is visible, with the label that sometimes turns invisible (for debugging). This shows that the label is added to the menu correctly. Right after the menu opens, I make that confirmation window and that label invisible.
When I then try to create a new save file, the confirmation window pops up and the label warning me about overwriting something is missing, as it should be. label.getIsVisible() also correctly returns false.
When I try to overwrite a save file instead, the confirmation window becomes visible, but while label.getIsVisible() returns true, the label is invisible. When I keep checking label.getIsVisible() over some time, it keeps claiming that the label is still visible, while the label actually remains invisible.
What is wrong here and how can it be fixed?
Many thanks in advance.