I am not too experienced with Java and am having trouble getting a progress bar to work. I am using Netbeans' built-in GUI maker. Currently my program reads in images from a directory into an image array. Obviously this takes a bit of time, thus I would like a simple progress bar to update the user to know how far the loading is. I have used one of those drag-and-drop progress bar components.
- I currently can get the number of files in a directory and can calculate the percentage of files loaded
- The files successfully load into the array, but the progress bar is only updated after all files are loaded. I have tried revalidating and repainting while I loop but this does not work
- I have tried the various tutorials on docs.oracle but can't seem to get anything working.
- I believe SwingWorker is the class I should be using, is this correct?
Any help with an example or some advice would be greatly appreciated! Thanks!