/** Cancel all active downloads. */
 public void cancelActiveDownloads() {
   for (Component c : this.monitorPanel.getComponents()) {
     if (c instanceof DownloadMonitorPanel) {
       if (((DownloadMonitorPanel) c).thread.isAlive()) {
         DownloadMonitorPanel panel = (DownloadMonitorPanel) c;
         panel.cancelButtonActionPerformed(null);
         try {
           // Wait for thread to die before moving on
           long t0 = System.currentTimeMillis();
           while (panel.thread.isAlive() && System.currentTimeMillis() - t0 < 500) {
             Thread.sleep(10);
           }
         } catch (Exception ignore) {
         }
       }
     }
   }
 }
 protected double[] resizeArray(double[] oldArray) {
   int newSize = 2 * oldArray.length;
   double[] newArray = new double[newSize];
   System.arraycopy(oldArray, 0, newArray, 0, oldArray.length);
   return newArray;
 }
 protected int[] resizeArray(int[] oldArray) {
   int newSize = 2 * oldArray.length;
   int[] newArray = new int[newSize];
   System.arraycopy(oldArray, 0, newArray, 0, oldArray.length);
   return newArray;
 }