when the AWT Thread start
hi,
i want to know, when the AWT Thread start in the application.
According to tutorial it is started when any frame or applet start but i have checked before creating any window, it starts.
i have used SwingUtilities.invokeLater() method to code.
Is this method can also create the AWT thread.
# 5
I have gone through the link and try to implement as follows:
public static void main(String arg[]){
System.out.println(Thread.currentThread().getThreadGroup());// 1
SwingUtilities.invokeLater(new Runnable() {
public void run() {
System.out.println(Thread.currentThread()); // 2
}
});
}
when i run this code then -
At comment No. 1 -
Only main thread created and printed.
but when i used SwingUtilities.invokeLater method and print then it print AWT-EventQueue. So at this time how AWT-EventQueue created.
# 6
I still have no idea what you are talking about or what your problem is.
If you run the following program the JVM will execute and terminate because the program has finished executing:
public class Test
{
public static void main(String args[])
{
javax.swing.JFrame frame = new javax.swing.JFrame();
//frame.setVisible( true );
}
}
If you uncomment the setVisible(..) line and rerun, then the JVM will not terminate because the setVisible(...) method will start the GUI Event Thread which will be active waiting for user events (MouseEvents, KeyEvents...). The JVM will only terminate when you close the frame in which case the EDT will also be terminated.
If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program[/url] (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
Don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags[/url] so the posted code retains its original formatting.