java - jLabel output won't output text within same instance of GUI -


i have jlabel supposed output computer name based on active directory search. computer name gets assigned variable "cn" no problem, won't show on jlabel unless run gui again. how can jlabel text appear in real time within same instance of gui? cn variable appears towards bottom of code posted.

            stringbuffer sbuffer = new stringbuffer();             bufferedreader in = new bufferedreader(new inputstreamreader(p                     .getinputstream()));              try {                  while ((line = in.readline()) != null) {                      system.out.println(line);                      // textarea.append(line);                      string dn = "cn=fdcd111304,ou=workstations,ou=sim,ou=accounts,dc=fl,dc=net";                     ldapname ldapname = new ldapname(dn);                     string commonname = (string) ldapname.getrdn(                             ldapname.size() - 1).getvalue();                   }                 computerquery.sendparam();              } catch (ioexception e1) {                  // todo auto-generated catch block                  e1.printstacktrace();              } catch (invalidnameexception e1) {                 // todo auto-generated catch block                 e1.printstacktrace();             }              {                 try {                     fw.close();                  }                  catch (ioexception e1) {                     // todo auto-generated catch block                     e1.printstacktrace();                 }             }              try {                  in.close();              } catch (ioexception e1) {                  // todo auto-generated catch block                  e1.printstacktrace();              }              computerquery.sendparam();           }     });      try (bufferedreader br = new bufferedreader(new filereader("resultofbatch.txt")))     {           final pattern pattern = pattern.compile("cn=([^,]+).*");         try {             while ((scurrentline = br.readline()) != null) {                  string[] tokens = pattern.split(","); //this return array, containing string array splitted write inside it.                 //should in case split, since seperated ","                // system.out.println(scurrentline);                 cn = scurrentline.split("cn=",-1)[1].split(",",-1)[0];                  system.out.println(cn);                  testlabel.settext(cn);              }           } catch (ioexception e1) {             // todo auto-generated catch block             e1.printstacktrace();         }         } catch (ioexception e2) {             // todo auto-generated catch block             e2.printstacktrace();         } 

new code added

@override     protected integer doinbackground() throws exception {           system.out.println(cn);            testlabel.settext(cn);          return null;     } 


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -