예제 #1
0
 private boolean isDownloading() {
   for (int i = 0; i < downloadList.getComponentCount(); i++) {
     DownloadView dv = (DownloadView) downloadList.getComponent(i);
     if (dv.isDownloading()) {
       return true;
     }
   }
   return false;
 }
예제 #2
0
 private void doClose() {
   if (isDownloading()) {
     int result =
         JOptionPane.showConfirmDialog(
             getRootPane(),
             "Really close?",
             "Downloads in progress",
             JOptionPane.YES_NO_OPTION,
             JOptionPane.QUESTION_MESSAGE);
     if (result == JOptionPane.NO_OPTION) {
       return;
     }
     for (int i = 0; i < downloadList.getComponentCount(); i++) {
       DownloadView dv = (DownloadView) downloadList.getComponent(i);
       dv.stopWorker();
     }
   }
   all.remove(this);
   setVisible(false);
   if (all.size() == 0) {
     System.exit(0);
   }
 }