Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

ProgressMonitor

Posted on 2005-05-16
5
Medium Priority
?
170 Views
Last Modified: 2010-03-31
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.

   
0
Comment
Question by:javax_swing
  • 2
4 Comments
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 14013176
Instead of null, pass the parent container handle to the ProgressMonitor...

~Hemanth
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 14013188
0
 

Author Comment

by:javax_swing
ID: 14054137
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
 

Accepted Solution

by:
modulo earned 0 total points
ID: 14617270
PAQed with points refunded (100)

modulo
Community Support Moderator
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses
Course of the Month13 days, 9 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question