how to make pictures in progress show

  • Follow


Dear all,

Perhaps this is a stupid question, but I cannot find the answer, so please
help:

In a java-application (not an applet), a series of pictures is processed. In
one corner of the application window there is a jpanel PEEP which should
show each picture as it is in the works, just to make the user happy that
the work is indeed being done.
The problem is that my picutres are duly processed, only the PEEP panel is
not repainted for each new picture that goes into the mill. Instead, it is
only repainted at the end of the whole loop, showing the last processed
picture.
Yes, the repaint instruction is in the loop, like this:

void process(img[] series) {
	for (int i = 0; i < series.length; i++) {
		PEEP.setPicture (series[i]); //this puts the picture in PEEP
		PEEP.repaint();
		doWhatIsNeededWith(series[i]);
	}
}

what's wrong? tia.

WS
0
Reply wnstnsmith (13) 8/15/2003 1:11:01 PM


wnstnsmith@yahoo.com wrote:

> Thanks, but yes, I'm doing it from an event, i.e. in response to a
> buttonclick. (indeed, the button stays "pressed" all the time, that's
> another thing I don't much like but don't know how to get around).
> Second, a lot is done to these pics, so the process is quite slow. One would
> expect there to be ample time for the system to update the window.
> 
> WS

T\The event thread is the one that will draw your changes and draw the 
button unpressed.  If your using the event thread for your own nefarious 
purposes, it can't do any of those things it's suipposed to do. You need 
to do your stuff in a seperate thread.

0
Reply dzimm (93) 8/16/2003 12:27:34 PM


I get it. Thanks a lot!

WS
0
Reply wnstnsmith (13) 8/16/2003 7:08:10 PM

2 Replies
34 Views

(page loaded in 0.309 seconds)


Reply: