I'm facing a strange behavior from the Java Runtime(VM) when I'm trying to display a label or progress bar on the screen when something happens. The scenario is like this: the user will press a button to do a certain action this action is a kind of process on the DB which could take some seconds I'm displaying a message in a Jlabel field which is already in the form but set to be invisible when the form opens. Then when the user presses a button I'm setting this label to be visible and do some processing and then set it back again invisible as it was, which is very simple logic. problem is the Jlable is displayed after the processing is done and not before. The same problem with happens also a progress bar. Any explanation why is this happening?
here a sample of the code
Mylable.setVisible(false); defaullt status when the form opens
Event Occurend (user clicked a button)
Mylable.setVisible(true);
....... do some process here
Mylable.setVisible(false);