java - JList is not updating correctly when action listner is a thread -
i have button actionlistener thread. within thread's run method try update jlist setlistdata() method , not update. worked combobox not jlist. tried doing in invokelater thread didn't work.
class main{ jbutton btn = new jbutton(); jlist jlist = new jlist(); btn.addactionlistern(new actionlistener(){ actionperformed(actionevent e){ new itthread().start(); } }); class itthread extends thread{ run(){ string [] data = new string[2]; data[0] = "it" data[1] ="itd"; jlist.setlistdata(data); } } }
Comments
Post a Comment