/** Refresh the data in this table. */
 public void refreshTable() {
   Runnable refresh =
       new Runnable() {
         public synchronized void run() {
           tableChanged(new TableModelEvent(tableModel, TableModelEvent.HEADER_ROW));
           refreshCellWidths();
         }
       };
   if (SwingUtilities.isEventDispatchThread()) {
     refresh.run();
   } else {
     SwingUtilities.invokeLater(refresh);
   }
 }
예제 #2
0
 /**
  * This method runs the Runnable and measures how long it takes.
  *
  * @param r is the Runnable for the task that we want to measure
  * @return the time it took to execute this task
  */
 public static long time(Runnable r) {
   long time = -System.currentTimeMillis();
   r.run();
   time += System.currentTimeMillis();
   System.out.println("Took " + time + "ms");
   return time;
 }
예제 #3
0
  /** simply dump status info to the textarea */
  private void sout(final String s) {
    Runnable soutRunner =
        new Runnable() {
          public void run() {
            if (ttaStatus.getText().equals("")) {
              ttaStatus.setText(s);
            } else {
              ttaStatus.setText(ttaStatus.getText() + "\n" + s);
            }
          }
        };

    if (ThreadUtils.isInEDT()) {
      soutRunner.run();
    } else {
      SwingUtilities.invokeLater(soutRunner);
    }
  }