I was given a code which uses GridData as shown below:
public DetailView(Composite parent) {
carModel = new Composite(parent, SWT.NONE);
carModel.setLayoutData(new GridData(GridData.FILL_BOTH));
carModel.setLayout(new GridLayout());
}
public void constructView() {
carModelViewer = new TableViewer(carModelComposite, SWT.BORDER);
CarModelProvider = new carModelContentProvider();
carModelViewer.setContentProvider(carModelProvider);
carModelViewer.setLabelProvider(new CarModelLabelProvider());
Table carModel = carModelViewer.getTable();
carModel.setHeaderVisible(true);
carModel.setLinesVisible(true);
carModel.setLayoutData(new GridData(GridData.FILL_BOTH));
TableColumn carModelColumn = new TableColumn(carModel, SWT.LEFT);
carModelColumn.setText("Model:");
carModel.pack();
}
I wanted to know if its possible to edit the cells in the UI of the application. I tried reading the API and found two methods:
1. setCellEditor()
2. setCellModifier()
but am not sure about the parameters. Any help??
GridDatais completely unrelated to contents of cells, it just tells how the entire table should be positioned inside the parent composite. If you want to change the layout of the table, read Understanding layouts in SWT.If you want to let users change contents of cells instead, then read Building and delivering a table editor with SWT/JFace.