java - JTextArea.append() taking a few seconds -
I know this is a dumb question, but I'm not sure what I can do. My program is just sending a message through some servers. My program also has "console", which is just a JTextArea, the user knows what's going on. For some strange reason, append () takes a few seconds while calling. In fact, it is not actually attached unless the message is sent through the server. This is the place where I am lost, I attach to it, I also use System.out.println () to login, and logs are printed instantly in the console, while JTextArea is not attached Happen. I came with the sole reason that perhaps the thread is different from one action thread. I send this message on one click of the pocket button:
submit.addActionListener (@ Override Public Zero ActionPerfect (ActionAge RJX) {console.append ("Posting to GCM "N"); System.out.println (String) textField.getSelectedItem ()); String APKY = "..."; Content content; {content = createContent ("test"); POST2GCM.post (apiKey, Content);} hold (IOException e) {e.printStackTrace ();}}});
As you see, I add, then log in. My logs appear immediately Gives , But the append is not visible until POST2GCM.post (APK, Content) method can not be run.
Can anyone explain why this is, and if there is any workaround? < Your swing threading issue should be done on all server communication background threads, and all JTextArea text updates swing events. Should be done on the thread. Swingwalker, especially for updating your JTextArea (a JList better?) Scope uses its publication process / method pairs, and your code should work very well.
Comments
Post a Comment