Thread.currentThread().sleep(100);
Thread.sleep(100);
   public static void setColumnWidths(JTable table, Insets insets,         boolean setMinimum, boolean setMaximum) {      boolean done = false;      int retries = 0;      do {         try {            int columnCount = table.getColumnCount();            TableColumnModel tcm = table.getColumnModel();            int spare = ((insets == null) ? 0 : (insets.left +                  insets.right));            for (int i = 0; i < columnCount; i++) {               int width = calculateColumnWidth(table, i);               width += spare;               int n = tcm.getColumnCount();               TableColumn column = tcm.getColumn(i);               column.setPreferredWidth(width);               column.setWidth(width);               if (setMinimum == true) {                  column.setMinWidth(width);               }               if (setMaximum == true) {                  column.setMaxWidth(width);               }            }            done = true;         } catch (Exception e) {            // Usually this error is due to a race condition between this method            // and some other code modifying the TableColumnModel of this table            System.out.println(                  "Possible race condition detected, retrying...");            try {               retries++;               if (retries > 3) {                  done = true;               } else {                  Thread.currentThread().sleep(100);               }            } catch (Exception ee) {               System.err.println("Error retriying setColumnWidths:\n" +                     ee);               ee.printStackTrace();            }         }      } while (!done);   }