我的进度条在循环完成之前不会更新?为什么是这样?
for (String theURL : IPArray) {
URL url = new URL(theURL);
InetAddress address = InetAddress.getByName(url.getHost());
String temp = address.toString();
String IP = temp.substring(temp.indexOf("/") + 1, temp.length());
URLArray.add(IP);
Progress.percentage = (URLArray.size() * 100) / Progress.totalToDo;
Progress.ipProgress.setString(Progress.percentage + "%");
Progress.ipProgress.setValue(Progress.percentage);
Progress.ipProgress.repaint();
result += IP + System.getProperty("line.separator");
}
它只会在通过循环后更新,而不是在循环期间更新。