Link to home
Start Free TrialLog in
Avatar of Samisrini
Samisrini

asked on

ProgressBar

Hi
I have a problem in my current application(Works as application and applet also).
 
What it does basically is it sends a command to VB through Perl script and waits for the resultimage. As soon as it finds the image in the path it fetches that and shows that on screen.

Main thread waits and second thread waits and gets the image and as soon as it gets the image it notifies the main thread.
But now I want to show a ProgressBar while it is waitng for the image, but the problem is as the Main thread is waiting, the progressBar(Or even any animated gif) is not working. It is just showing the empty window.

Do you have any ideas...solutions????

Thanks in Advance
Samisrini
Avatar of JDay
JDay

Have you tried useing a progress bar?


       // Create a new JProgressBar
        METER_bar = new JProgressBar(0, 100);
JDay
Avatar of Mick Barry
Can we see the code handling the progress bar pls.

I have extended JDialog and added the progress bar to a panel. This is a method I use to display the meter.
This works for JBuilder 4. What are you useing to build your java program?


JProgressBar METER_bar = new JProgressBar(0, 100);

Use a method to display status bar and percentage complete

    public void Display(int total, int amount)
    {
        // Make the frame visible
        this.setVisible(true);

        // If incorrect value is passed in, return
        if ((total == 0) || (amount > total))
            return;

        // Set METER_total equal to total passed in
        if (total != METER_total)
            METER_total = total;

        // Set METER_amount to amount arg passed in
        METER_amount = amount;

        // Call Draw() to update progress bar
        Draw();

        METER_bar.repaint();
    }



JDAY
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- To be PAQ'ed and points NOT refunded

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

vemul
Cleanup Volunteer
ASKER CERTIFIED SOLUTION
Avatar of Banath
Banath

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial