// Asynchronous, the current thread will NOT wait until the method is invoked
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
// Perform GUI update operation
}
});
// Synchronous, the current thread will wait until the end of the run() method
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
// Perform GUI update operation
}
});
If you want very fine grained access to thread locking, semaphores and mutexes, you can use the
Doug Lea's library if you're running on J2SE 1.4 or below (a version of this is included in J2SE 1.5, look in java.util.concurrent package)
SJCP, SCBCD, SJCD, SCDJWS, SCEA (Part I)