i'm trying to update Swing JSLable text before processing loop, but it's not updating:
public void actionPerformed(ActionEvent event)
{
title.setText("Ready"); // Initialize display
if (source == uploadButton) {
int returnVal = fc.showOpenDialog(UserInterface.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File[] files = fc.getSelectedFiles();
if (files.length < 2) {
title.setText("<html>Text1</html>"); // Is shown
} else {
title.setText("<html>Text2</html>"); // Not displaying, feels like UI is locked here
for (int i = 0; i < files.length; i++) {
filesUploaded.add(uploadFile(files[i]));
}
Images imgs = new Images();
imgs.processImages(filesUploaded); // Some processing loop inside, takes around 0.5~1s
title.setText("Completed"); // displayed corectly.
}
}
}
}
So basically i wish to have sequence:
Ready
Text2
Completed
but i get this sequence (with missing Text2
output):
Ready
Completed