1

I am writing a program that creates a folder for each file in a specific folder. After that the file is copied in the, just created, folder. Everything works, except the JProgressbar I want to add to the program. I also added a Jtextarea but after a file is copied i want to change the progress bar, and add some text to the JTextarea. while the program runs nothing appears but when the whole task is completed all of the text I want in the JTextArea is shown and the progress bar is 100%. I don't know what i did wrong.

Kai
  • 38,985
  • 14
  • 88
  • 103
vanlooverenkoen
  • 2,121
  • 26
  • 50
  • Take a look at [Concurrency in Swing](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/) and [Worker Threads and SwingWorker](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/worker.html) – MadProgrammer Jul 14 '15 at 13:05
  • Then have a look at [this example](http://stackoverflow.com/questions/24835638/issues-with-swingworker-and-jprogressbar/24835935#24835935) and [this example](http://stackoverflow.com/questions/15199091/progress-bar-java/15199220#15199220) and [this example](http://stackoverflow.com/questions/20778551/implementing-jscrollpane-jtextarea-in-swingworker/20778585#20778585) as a starting point – MadProgrammer Jul 14 '15 at 13:07
  • oke tnx I will try this – vanlooverenkoen Jul 14 '15 at 13:10

1 Answers1

0

After the examples that MadProgrammer gave me. I figured out how it worked. You need to update your progresbar in the Swingworker and all the Methodes you want to call, you need to call them in the SwingworkerMethod.

Community
  • 1
  • 1
vanlooverenkoen
  • 2,121
  • 26
  • 50