ProgressMonitor

Hello experts,

I am running into a problem....

I have many cmopression, encryption and utility classes, which I use in my program. in each class I have added a progress monitor. Things work very fine when I write a little main method. However, when I have done the GUI, things changed, The ProgressMonitor Dialogs started to appear but with nothing in them, empty.

My progressMonitor is not in the GUI classes, so why does it behave differently when it is called from the GUI.

The way I use the ProgressMonitor is as follows:

public class XORCipher implements EncryptionAlgorithm {

    public File encrypt(File file, String sec) {
      //............
    }

    private void runBitCipher(){
        try
          {  
            ProgressMonitor progressBar =
                new ProgressMonitor(null, "BitCipher", "Running Cipher...", 0, (int)inFile.length()/secretWord.length());
                int counter=0;
           
                while (true && !endOfFileReached){
                    progressBar.setProgress(counter++);
                    word = "";

                    //.....

                    }
    }
 //.........

and the same for the other classes.

do you have any idea about why when I call this class from a non-GUI class the progressMonitor works ok, but when I invoke it from a GUI class it is empty?

Looking forward to your answers.

   
javax_swingAsked:
Who is Participating?
 
moduloCommented:
PAQed with points refunded (100)

modulo
Community Support Moderator
0
 
HemanthaKumarCommented:
Instead of null, pass the parent container handle to the ProgressMonitor...

~Hemanth
0
 
HemanthaKumarCommented:
0
 
javax_swingAuthor Commented:
Hello...

Thank you for your answer.

I have tried that, but it did not work.

I found the answer anyways...
I found out that it is a matter of performance, and not a programming thing, so what I did is that I made my program invoke the progress monitor, and then invoke my work on another thread, this way I was able to see my progress monitor working properly.

Thank you for answering anyways.

regards...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.