I might not be the best java programmer but I thought java waited until the expression ran until it went to the next one, unless you're useing threads.
In my program I run this code:
chatDoc is a Styled Document.Code:chatDoc.insertString(chatDoc.getLength(), "---Attemping to Connect...---\n", alertStyle);
System.out.println("---Attemping to Connect...---");
Thread.sleep(1000);
I thought java would first display the text in the Document, then println() and then sleep for 1 sec. However, first it runs println(), then sleeps for a sec, and then displays the text in the Doc. It is very important to my program that the code runs in order. Any ideas for why it doesn't run correctly?

