相关疑难解决方法(0)

JTextArea附加问题

我正在制作一个备份程序,我希望我在JTextArea上显示备份程序的所有内容.好吧,它工作,但只有在程序完成备份后.我该如何解决?我运行的代码在这里:

备份方法

public void startBackup() throws Exception {
    // txtarea is the JTextArea
    Panel.txtArea.append("Starting Backup...\n");

    for (int i = 0; i < al.size(); i++) {
        //al is an ArrayList that holds all of the backup assignments selected
        // from the JFileChooser

        File file = new File((String) al.get(i));
        File directory = new File(dir);

        CopyFolder.copyFolder(file, directory);
            }
     }
Run Code Online (Sandbox Code Playgroud)

复制文件夹类:

public class CopyFolder {
public static void copyFolder(File src, File dest) throws IOException {

    if (src.isDirectory()) {

        // if directory not exists, create …
Run Code Online (Sandbox Code Playgroud)

java swing multithreading swingworker jtextarea

3
推荐指数
1
解决办法
3019
查看次数

标签 统计

java ×1

jtextarea ×1

multithreading ×1

swing ×1

swingworker ×1