title: Java SWT: how to delete the selected row in a SWT table
body: <p>I have implemented one SWT table having a button widget in one column. On click of a button I am deleting the entire row. But I don't understand how to refresh/redraw/update the table.</p>
  
  <pre><code>Table processListTable;
  TableItem tableItem;
  Image deleteImage = Activator.getImageDescriptor("icons/trash.gif").createImage();
  
  private void addRowInTable() {
      tableItem = new TableItem(processListTable, SWT.FILL);
      tableItem.setText(0, "value 1");
      tableItem.setText(1, "value 2");
  
      TableEditor editor = new TableEditor(processListTable);
  
      final Button deleteButton = new Button(processListTable, SWT.PUSH | SWT.FILL);
      deleteButton.pack();
  
      editor.minimumWidth = deleteButtonButton.getSize().x;
      editor.horizontalAlignment = SWT.CENTER;
      editor.setEditor(deleteButtonButton, tableItem, 2);
      deleteButtonButton.setImage(deleteImage);
      deleteButtonButton.addListener(SWT.Selection, new SelectionListener(tableItem, checkButton));
  }
  
  class SelectionListener implements Listener {
      TableItem item;
      Button deleteButton;
  
      public SelectionListener(TableItem item, Button deleteButton) {
          this.item = item;
          this.deleteButton = deleteButton;
      }
  
      public void handleEvent(Event event) {
  
          this.deleteButton.dispose();
          this.item.dispose();
      }
  }
  </code></pre>