JList is not updating correctly when action listner is a thread

I have a button ActionListener that is a Thread. Within this thread's run method I try to update a JList setListData() method and it does not update. It worked with a combobox but not a JList. I also tried doing it in an invokeLater thread but 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);
        }
    }


}

Answers


Need Your Help

NOT GETTING (0x00) VALUE IN AxSerial.ComPort - PHP

php serial-port

I am using http://www.activexperts.com/serial-port-component/ API for communicating with RS-232 device in PHP.

Blurry UILabel when added programatically

ios ios5 uilabel blurry

I am adding a UILabel to a view meant for loading purposes. However, it gets blurry after I added it.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.