Introduction | Your first interface | Building a model | Advanced features | Resources

4.7 Tables

This section shows you how to create tables to display or manipulate data. The Interface Builder will create tables from 1- or 2-dimensional arrays of integers, Strings, characters or booleans. The model and interfaces used in this section can be downloaded here: trainingTables.zip.

In the example below, arrays of strings, integers and booleans are used.

The modelProperty property allows you to set the model property to be displayed by the table. The InputTable property can be set to true or false depending on whether you want the end user to be able to alter the contents of the table at runtime or not.

You can set the direction in which the table is to be displayed using the swapRowsAndCols property, and the useScrollBars property determines whether scrollbars are displayed when the table gets too big for the area in which it is being displayed. The spacing between the rows and columns can be set using the hgap and vgap properties.

Boolean tables have additional properties that they can use: falsePrompt and truePrompt both of which can be set to a String. If these are set then the strings will be displayed in the table instead of 'true' and 'false'.

Tables are heavyweight objects and when using them in the interface builder you may find that all other objects tend to disappear behind. This is annoying but will not affect the final simulation. Tables will be updated to stop this happening in a future release.