ciao andbin!
ho provato a cambiare usando SwingWorker.
questo pare funzionare:
ma a prescindere dal fatto che funzioni, può andare come soluzione?codice:FileChooserOpen fco = new FileChooserOpen(); fco.showOpenDialog(null); File dir = fco.getDir(); SwingWorker worker = new SwingWorker<Void, Void>() { @Override protected Void doInBackground() { try { north.getBtnStop().setEnabled(true); bar.setIndeterminate(true); bar.setString("Loading..."); Scan utils = new Scan(); ArrayList<Record> list = utils.scanDir(dir.toPath()); countFile = list.size(); for (int i = 0; i < list.size(); i++) { String n = list.get(i).getNome(); String t = list.get(i).getTipo(); String p = list.get(i).getPath(); Object[] row = {n, t, p}; model.addRow(row); try { Thread.sleep(200); } catch (InterruptedException ex) { JOptionPane.showMessageDialog(null, ex.getMessage()); } } } catch (IOException ex) { JOptionPane.showMessageDialog(null, ex.getMessage()); } return null; } @Override public void done() { north.getLabelCount().setText("No. file " + countFile); north.getBtnStop().setEnabled(false); resizeColumnWidth(); bar.setIndeterminate(false); bar.setString(""); } }; worker.execute();

Rispondi quotando