Java loading gif freeze while processing data?

前端 未结 2 1392
萌比男神i
萌比男神i 2020-12-12 03:03

I call a method which lists all the files in a directory, and adds them to a JTable:

    addFilesWithSubsButton.addActionListener(new ActionListener() {
             


        
2条回答
  •  轮回少年
    2020-12-12 03:50

    My guess would be that your addFilesWithSubs2-Method is blocking the UI thread. If you have long running tasks, than you have to execute them in a separate thread e.g. SwingWorker

提交回复
热议问题