equal
deleted
inserted
replaced
598 } |
598 } |
599 }, |
599 }, |
600 time, printEvent); |
600 time, printEvent); |
601 |
601 |
602 } |
602 } |
|
603 |
|
604 |
|
605 /** |
|
606 * Invokes the <code>task</code> on the EDT thread. |
|
607 * |
|
608 * @return result of the <code>task</code> |
|
609 */ |
|
610 public static <T> T invokeOnEDT(final java.util.concurrent.Callable<T> task) throws Exception { |
|
611 final java.util.List<T> result = new java.util.ArrayList<T>(1); |
|
612 final Exception[] exception = new Exception[1]; |
|
613 |
|
614 javax.swing.SwingUtilities.invokeAndWait(new Runnable() { |
|
615 |
|
616 @Override |
|
617 public void run() { |
|
618 try { |
|
619 result.add(task.call()); |
|
620 } catch (Exception e) { |
|
621 exception[0] = e; |
|
622 } |
|
623 } |
|
624 }); |
|
625 |
|
626 if (exception[0] != null) { |
|
627 throw exception[0]; |
|
628 } |
|
629 |
|
630 return result.get(0); |
|
631 } |
|
632 |
603 } |
633 } |