A table can be considered a two-dimensional grid composed of several cells. A possible use for tables is the storage of the results of database queries. In order to add data to a table, it is necessary to use a TableItem
object. Each instance of a TableItem
object is responsible for an entire row of a table. The values can be set using the setText
and setImage
methods that takes an integer as parameter to identify which column should be modified.
In a similar fashion to the TableItem
object, the TableColumn
object receives a table as a parameter in order to associate both objects. Each time a TableColumn
object is associated, a new column is created in the corresponding table.
The following code snippet shows how to create a SWT table:
... Display display = new Display(); Shell shell = new Shell(display); shell.setSize(500,400); shell.setText("Table Example"); shell.setLayout(new FillLayout( )); Table table...