java - Updating jTextArea in while loop -


i having problem writing/updating textarea. getting value readtemp function, , can see result after calling system out function, nothing appears in textarea. problem?

private void jbutton1actionperformed(java.awt.event.actionevent evt) {                                              url temp;     try      {             temp = new url("http://192.168.1.25/status.xml");             while (true)             {                 system.out.println("homerseklet: " + readtemp(temp));                 jtextarea1.append(readtemp(temp));             }                        }      catch (malformedurlexception ex)      {         logger.getlogger(download.class.getname()).log(level.severe, null, ex);     } }                                         

correction: won't since infinite loop still block edt forever... nevermind!

your while loop really bad idea, if insist, can @ least give edt chance update ui dispatching append asynchronously:

swingutilities.invokelater(new runnable() {     @override     public void run() {         jtextarea1.append(readtemp(temp));         } }); 

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -