title: usage of progress bar in SWT in java
body: <p>Actually i am using threads to update progress bar inside a block of code ,The run method of the thread is not working,So,could you please help me resolve the problem.I am using SWT toolkit for the UI.<br>
          CODE:          </p>
  
  <p>//selection listener   </p>
  
  <pre><code>    tItem.addSelectionListener(new SelectionAdapter() {
                          public void widgetSelected(SelectionEvent e) 
                          {
               TableItem[] tableItems =table.getItems();
                          int c=0;
                  int inty=table.getSelectionIndex();
                    for(int i=table.getSelectionIndex();i&lt;tableItems.length;i‌++)
                     {    
                          if(c==0)
                          {
                            column = new TableColumn(table, SWT.CENTER);       
       //reading content from the table        Stringline=tableItems[i].getText(0)+","+tableItems[i].getTex‌t(1)+","+tableItems[‌​i].getText(2)+","+ta‌​bleItems[i].getText(‌​3)+","+tableItems[i]‌​.getText(4)+","+tabl‌​eItems[i].getText(5)‌​+","+tableItems[i].g‌​etText(6);
                           System.out.println("\n line value is "+line);
                          String split= ",";
                          String error=",,,,,,";
                          if(line.equals(error))
                          {
                          break;
                          }
                      else {while ((line!= null))
                      String[]com = line.split(split,20);
                      String result =null;
  //checking whether the value in it is enable or n
                      if(com[0].contains("ENABLE"))
                      { result = "RESULTS"; 
                      continue;}
                      if(com[0].equals("N"))
                      {result = "No";} 
                      else if(com[2].startsWith("S=") )
                      {
                       String O=tableItems[i].getText(7);
                       String[] part = O.split("=");
                       String string2 = part[1];
                       a=Integer.parseInt(string2);
      //declaration of the thread
                       final Thread thread = new Thread()
                      {public void run() 
                      {for(int i=0; i&lt;=a; i++) 
                      {
                      final int value = i;
                      try {
                      Display.getDefault().asyncExec(newRunnable() 
                      {
                          public void run() 
                      { 
      //assigning value to the progress bar
      pbar.setSelection(value);
                      }
                      });
                      }   
                      catch (Exception e) 
                      {
                      System.out.println("Warning");
                       } 
                      } 
                      }
                      thread.start(); 
                      inty++;
                      break;
                      }
      }
      });
  </code></pre>