I want JList to be populated with multiple threads. I tried this way but jlist is empty. It would be good if jlist was updated on the fly There are two threads, the other one loads in anouther direction
new Thread(new Runnable() {
@Override
public void run() {
for(i=0; i<cells.size()/2; i++){
System.out.println("thread");
try{
HtmlPage p = client.getPage("https://tbilisi.embassytools.com/en/slotsReserve?slot="+cells.get(i).getAttribute("data-slotid"));
pages.add(p);
if(!p.getUrl().toString().contains("slotsReserve"))
model.add(i,p.getUrl().toString());
}
catch (Exception e){
e.printStackTrace();
}
}
}
});
list1.setModel(model)
Thanks in advance
UPDATE* So I fixed by using SwingWorker