Problem with the ProgressMonitor.
I have a small problem with the ProgressMonitor.
I programmed it in my source code, because I would like to demonstrate the procedure of loading samples of a program I am building at the moment.
The problem is that the ProgressMonitor does not appear, when the loading of the samples begins. I tried several ways to get the ProgressMonitor work, but I failed everytime.
Can someone of you tell me what I have done wrong in the source code?
Here is the source code. There are 2 parts.
Code of loading the samples:
class UpdateLoadSamples implements Runnable
public void run()
int percent = (int) Math.round((si*1.0/numberOfToMakeSamples)*100.0);
public void loadSamples(int numberOfMakingSamples) throws OutOfMemoryError, IOException, Exception
FUtils.startProgressMonitor("Samples are being loaded.");
Timer timer = new Timer(100, this);
for (si = numberOfMadeSamples - numberOfMakingSamples; si < numberOfMadeSamples; si++)
Sample sample = getSample(si);
// Make Samples directory
String sampleDirName = FUtils.convertStringToFileNameString(sample.getSampleName());
this.projectSamplesDirsAndFiles.put(this.currentSampleDirectory, new TreeMap<String, String>());
sampleDir = this.project + getCurrentSampleDirectory();
public void actionPerformed(ActionEvent e)
Here is the source code of showing and updating the ProgressMonitor:
The ProgressMonitor is situated in a static class, called FUtils, with the following static methods and variables:
public static ProgressMonitor progressMonitor;
public static void startProgressMonitor(String message)
FUtils.progressMonitor = new ProgressMonitor(null, "Monitoring Progress",
"Initializing . . .", 0, 100);
public static void setProgressInProgressMonitor(int percent)
progressMonitor.setNote(String.valueOf(percent) + " %");
Thank you very much for your help in advance. I am looking forward!