class doClose implements Runnable {
public void run() {
//.. access Swing components here ..
}
};
doClose dc = new doClose();
if (SwingUtilities.isEventDispatchThread())
dc.run();
else {
try {
SwingUtilities.invokeAndWait(dc);
} catch (Exception e) {}
}