Do I need Threads for this?



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


.



Relevant Pages

  • Newbie help
    ... Newbie here. ... the value of the cells in column "b" depending if THIS or THAT ... value in column B. The variable would switch values when it read ... Would I have to use a For Next loop and ...
    (microsoft.public.excel.programming)
  • Re: How to choose FPGA for a huge computation?
    ... Depending on the accuracy and bit size. ... in one clock cycle. ... the loop above is only one of a half dozen intermediate ... orders require different "relatively random" accesses to the memory ...
    (comp.arch.fpga)
  • Re: [PHP] Static Pages with PHP
    ... depending on some ... parameters I will display a static page from within my PHP code. ... you probably want to fopen/fread in a loop. ...
    (php.general)
  • Deleting lines with a variable.
    ... In my macro I want to delete some lines depending on a test. ... I loop through some lines and do a check whether to delete the line. ... Prev by Date: ...
    (microsoft.public.excel.programming)
  • Re: WAIT... why?
    ... Depending on how getNextIndexIntoWavetableworks it looks like you could split the loop into two threads. ... Left & right channel threads and wait for both before returning, that mixed with any possible fpu improvements the others come up with could add up to quite a bit. ... Always assume I'm posting without coffee. ...
    (borland.public.delphi.language.basm)