Do I need Threads for this?
- From: <nospam@xxxxxxxxxxxxxxx>
- Date: Tue, 5 Dec 2006 15:16:11 -0000
I've got a method that copies files from one place to another. Each time the
file copies over it takes roughly 10 seconds per file (depending on how
large the file is).
In the meantime, I need my JPanel label to update with the current number of
files copied over so far.
I know from looking at the FAQs for this newsgroup that the GUI isn't
updating because it probably needs a new thread, but as a complete newbie to
threads, I'm wondering if I really need to learn about Threads to get my
relatively simple job done. My code simply runs in a for loop -
int count=0;
for (int i=0; i < 12; i++) {
mycopyOverFileMethod();
count++;
label.setText("Files Copied:" + count);
// Why is there no simple way in java just to put here something like :
// label.redraw();
// that avoids the need for threads??
}
Is there something simple I could do?
TIA
.
- Follow-Ups:
- Re: Do I need Threads for this?
- From: Wesley Hall
- Re: Do I need Threads for this?
- From: DRS.Usenet@xxxxxxxxxxxxxxxx
- Re: Do I need Threads for this?
- Prev by Date: Re: Giving an application a window icon in a sensible way
- Next by Date: Re: Giving an application a window icon in a sensible way
- Previous by thread: Re: Java Posters?
- Next by thread: Re: Do I need Threads for this?
- Index(es):
Relevant Pages
|