JProgresbar不能与Files.copy一起使用 [英] JProgresbar doesn't work with Files.copy

查看:189
本文介绍了JProgresbar不能与Files.copy一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个程序,为特定文件夹中的每个文件创建一个文件夹。之后,文件被复制到刚刚创建的文件夹中。一切正常,除了JProgressbar我想添加到程序。我也添加了一个Jtextarea,但在一个文件被复制后,我想改变进度条,并添加一些文本到JTextarea。而程序运行没有任何显示,但当整个任务完成时,我想要的JTextArea中的所有文本显示,进度条是100%。

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.

推荐答案

之后的示例 MadProgrammer 给了我。我想出了它是如何工作的。你需要在Swingworker和你想要调用的所有方法中更新你的进度条,你需要在SwingworkerMethod中调用它们。

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.

这篇关于JProgresbar不能与Files.copy一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆