Page 3 of 3
To avoid this deadlock catastrophe, either switch to a "better" language or use the advanced features of Java (which makes Java the better language). Simply show the modal dialog box in a new thread, and all is peaches and roses in Javaland. This is what we have done in the code above. This type of deadlock is common until one understands its cause and has a simple solution for preventing it.
The rest of MessageBox is self-explanatory. Study the MessageBox code and the MessageBoxTest application and have fun.
JavaWorld would like to pass on your Java Tip to the rest of the Java world. Write up your coolest tips and tricks now, and send them to javatips@javaworld.com. You may find yourself an author in JavaWorld with your helpful hints chosen as the next Java Tip!
cvzxvzBy Anonymous on September 9, 2009, 12:58 pmvzxcvczx
Reply | Read entire comment
View all comments