JProgressBar bar not showing up till complete  
Author Message
6e





PostPosted: 2005-7-22 21:52:00 Top

java-programmer, JProgressBar bar not showing up till complete Hi thanks for reading.

Im sure the answer to this is simple, it just eludes me at this point.

Im tring to use a progress bar to simply show the progress of 55 files
being created and saved to disk. However when I use the JProgressBar
in my code, it only shows up when the task is completed... Obviously I
need it to be shown updating the entire time, seems like im missing
something pretty basic.

heres the code for your perusal, the updates occurs later in the code,
but since its not showing up until it is completed I believe the error
is here + Thanks! :

//start up progress FRAME
JFrame jfrProgress = new JFrame("Creating Movie...");
Container contentPane = jfrProgress.getContentPane();
SpringLayout layout = new SpringLayout();
contentPane.setLayout(layout);

//set up progress BAR
JProgressBar pbProgress;
pbProgress = new JProgressBar(ISTARTFRAME, iFinalFrame);
pbProgress.setValue(ISTARTFRAME);
pbProgress.setStringPainted(true);
pbProgress.setString("Step 1 - Creating Files...");
pbProgress.setSize(500, 40);

//add progress bar to frame
jfrProgress.getContentPane().add(pbProgress);

//display frame
jfrProgress.setLocation(400, 300);
jfrProgress.setSize(250, 100);
pbProgress.setVisible(true);
jfrProgress.setVisible(true);

 
Andrew Thompson





PostPosted: 2005-7-22 22:19:00 Top

java-programmer >> JProgressBar bar not showing up till complete On 22 Jul 2005 06:51:33 -0700, 6e wrote:

> Im sure the answer to this is simple, it just eludes me at this point.
>
> Im tring to use a progress bar to simply show the progress of 55 files
> being created and saved to disk. However when I use the JProgressBar
> in my code, it only shows up when the task is completed... Obviously I
> need it to be shown updating the entire time, seems like im missing
> something pretty basic.

Now thoroughly out of date, but this qn. was covered in
an early version..
<http://www.physci.org/guifaq.jsp#2.1>

Note that GUI questions are best directed to..
<http://www.physci.org/codes/javafaq.jsp#cljg>

HTH

--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
See You On Some Other Channel
 
aotemp





PostPosted: 2005-7-22 22:28:00 Top

java-programmer >> JProgressBar bar not showing up till complete Hi thanks for reading.


Im sure the answer to this is simple, it just eludes me at this point.


Im tring to use a progress bar to simply show the progress of 55 files
being created and saved to disk. However when I use the JProgressBar
in my code, it only shows up when the task is completed... Obviously I

need it to be shown updating the entire time, seems like im missing
something pretty basic.


heres the code for your perusal, the updates occurs later in the code,
but since its not showing up until it is completed I believe the error
is here + Thanks! :


//start up progress FRAME
JFrame jfrProgress = new JFrame("Creating Movie...");
Container contentPane = jfrProgress.getContentPane();
SpringLayout layout = new SpringLayout();
contentPane.setLayout(layout);


//set up progress BAR
JProgressBar pbProgress;
pbProgress = new JProgressBar(ISTARTFRAME,
iFinalFrame);
pbProgress.setValue(ISTARTFRAM璄);
pbProgress.setStringPainted(tr璾e);
pbProgress.setString("Step 1 - Creating Files...");
pbProgress.setSize(500, 40);


//add progress bar to frame
jfrProgress.getContentPane().a璬d(pbProgress);


//display frame
jfrProgress.setLocation(400, 300);
jfrProgress.setSize(250, 100);
pbProgress.setVisible(true);
jfrProgress.setVisible(true);

 
 
aotemp





PostPosted: 2005-7-22 22:30:00 Top

java-programmer >> JProgressBar bar not showing up till complete also I read the faq, but none of the answers SEEM to pertain to this
case...

 
 
Thomas Weidenfeller





PostPosted: 2005-7-22 22:51:00 Top

java-programmer >> JProgressBar bar not showing up till complete email***@***.com wrote:
> also I read the faq, but none of the answers SEEM to pertain to this
> case...

I don't remember that there is something pertinent to progress bars in
the FAQ - and I should know :-) But Q3.1 and Q3.2 might apply.
Particular, because you didn't show us how you run the file creation and
how you do the updating (see Q2.4 in the FAQ for this one).

/Thomas

--
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
 
 
Thomas Fritsch





PostPosted: 2005-7-22 23:11:00 Top

java-programmer >> JProgressBar bar not showing up till complete 6e wrote:
> Hi thanks for reading.
>
> Im sure the answer to this is simple, it just eludes me at this point.
>
> Im tring to use a progress bar to simply show the progress of 55 files
> being created and saved to disk. However when I use the JProgressBar
> in my code, it only shows up when the task is completed... Obviously I
> need it to be shown updating the entire time, seems like im missing
> something pretty basic.
>
> heres the code for your perusal, the updates occurs later in the code,
> but since its not showing up until it is completed I believe the error
> is here + Thanks! :
Since you didn't bother posting a complete compilable example, this is
how I completed it (based on my vague guesses) to get it compiled and
running:

import java.awt.*;
import javax.swing.*;

public class Main
{
static int ISTARTFRAME = 0;

public static void main(String[] args)
{
int iFinalFrame = 100;
>
> //start up progress FRAME
> JFrame jfrProgress = new JFrame("Creating Movie...");
> Container contentPane = jfrProgress.getContentPane();
> SpringLayout layout = new SpringLayout();
> contentPane.setLayout(layout);
>
> //set up progress BAR
> JProgressBar pbProgress;
> pbProgress = new JProgressBar(ISTARTFRAME, iFinalFrame);
> pbProgress.setValue(ISTARTFRAME);
> pbProgress.setStringPainted(true);
> pbProgress.setString("Step 1 - Creating Files...");
> pbProgress.setSize(500, 40);
>
> //add progress bar to frame
> jfrProgress.getContentPane().add(pbProgress);
>
> //display frame
> jfrProgress.setLocation(400, 300);
> jfrProgress.setSize(250, 100);
> pbProgress.setVisible(true);
> jfrProgress.setVisible(true);
>
}
}

For me the progressbar shows up, and it visualizes 0% as expected,
because the progress bar is never updated by further
pbProgress.setValue(...) calls.

I'm sure you would get much more enlightening answers from this group,
if you post a SSCCE <http://www.physci.org/codes/sscce.jsp> here.

--
"Thomas:Fritsch$ops:de".replace(':','.').replace('$','@')

 
 
6e





PostPosted: 2005-7-22 23:25:00 Top

java-programmer >> JProgressBar bar not showing up till complete You're right, if the last update of the progress bar is a 0%, then it
will be displayed, but while its updating, it does not show up until it
is completed. Thanks for the response though.


I decided to fully alter and customize the Progress monitor example
located here, for anyone with similar difficulties:

http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html

 
 
6e





PostPosted: 2005-7-22 23:26:00 Top

java-programmer >> JProgressBar bar not showing up till complete I found an example online that I plan to fully customize and recode its
located here for all who are searching

its the progress monitor demo...
http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html

 
 
Andrew Thompson





PostPosted: 2005-7-22 23:32:00 Top

java-programmer >> JProgressBar bar not showing up till complete On Fri, 22 Jul 2005 16:50:36 +0200, Thomas Weidenfeller wrote:

> email***@***.com wrote:
>> also I read the faq, but none of the answers SEEM to pertain to this
>> case...
>
> I don't remember that there is something pertinent to progress bars in
> the FAQ - and I should know :-) But Q3.1 ..

Aaah yes.. That shows how thoroughly outdated is the
copy at physci [to which I linked as qn. 2.1 (on c.l.j.p.)].

> ..and Q3.2 might apply.

Yep. That's what I'm thinking - 'blocking the EDT' sounds the
root cause, lacking evidence to the contrary..

> Particular, because you didn't show us how you run the file creation and
> how you do the updating (see Q2.4 in the FAQ for this one).

Splendid idea, Thomas.

--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
Too Hot For Radio