swing - how to get variable value from a java thread -


i have thread computes , generates 2 d array. need access value of 2 d array, when thread finished. how can that

        swingworker<integer, void> worker = new swingworker<integer, void>()         {             object[][] valuematrix = null;              @override             public integer doinbackground()             {                 try                 {                     valuematrix = dochemicalsynonyms(termsarray_1, termsarray_2, mview.getsavefilepath(), false, mview.getsheetname(), mview.getcategoryname(), mview.includepmids());                 }                 catch (exception e)                 {                     e.printstacktrace();                     return -1;                 }                 return 0;             }              @override             public void done()             {                 system.out.println(valuematrix[0][0]);             }         };         worker.execute(); 

dochemicalsynonyms functions generates valuematrix. how can access once thread complete, main class( global variable)

what should use done() method collect result thread. printing first value, can transfer thread use there.

beware done() invoked in edt, if need intensive operariton on it, thread necessary.


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -