Search code examples
javafilecopyjtextareajprogressbar

JProgresbar doesn't work with Files.copy


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.


Solution

  • 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.