Adding a remove button to a column in a table

前端 未结 4 1598
小蘑菇
小蘑菇 2020-12-03 12:26

Is it possible to add a Remove button to a cell in a table?

I have a table with 5 columns, I would like to add a 6th column. I want the 6th column to have

4条回答
  •  萌比男神i
    2020-12-03 13:08

    Below code should work for you

    TableItem item = (TableItem) item;
    Button button = new Button(table,swt.none);
    button.setText("Remove");
    control.setBackground(item.getBackground());
    TableEditor editor = new TableEditor(table);
    editor.grabHorizontal  = true;
    editor.grabVertical = true;
    editor.setEditor(button , item, columnIndex);
    editor.layout();
    

提交回复
热议问题