Posted on 2005-05-16
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(){
            ProgressMonitor progressBar =
                new ProgressMonitor(null, "BitCipher", "Running Cipher...", 0, (int)inFile.length()/secretWord.length());
                int counter=0;
                while (true && !endOfFileReached){
                    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.

Question by:javax_swing
    LVL 24

    Expert Comment

    Instead of null, pass the parent container handle to the ProgressMonitor...

    LVL 24

    Expert Comment


    Author Comment


    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.


    Accepted Solution

    PAQed with points refunded (100)

    Community Support Moderator

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Suggested Solutions

    Title # Comments Views Activity
    copyEvens challenge 6 46
    java continue statement 10 51
    noX challenge 17 52
    parentbit challenge 3 37
    INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
    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…
    Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
    This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

    760 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now