What you were told is wrong. First, the method mainis called by the main thread. All GUI-related activities must be performed in a completely separate thread called Thread Dispatch Thread. The main thread does not turn into EDT.
A good example of what I say:
public class ThreadTest {
public static void main(String[] args) {
final Thread main = Thread.currentThread();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
Thread edt = Thread.currentThread();
System.out.println(main);
System.out.println(edt);
System.out.println(main.equals(edt));
}
});
}
}
source
share