Table (tag) |
From JAXXWiki
The <Table> tag is a special class tag referring to the class jaxx.runtime.swing.Table. The Table component uses GridBagLayout and contains <row> and <cell> tags to ease the creation of complicated layouts.
Example table:
<JFrame title='Simple Table'>
<Table>
<row>
<cell><JLabel text='Northwest'/></cell>
<cell><JLabel text='Northeast'/></cell>
</row>
<row>
<cell columns='2'><JLabel text='South'/></cell>
</row>
</Table>
</JFrame>
This table contains three cells in two rows. The first row contains two cells, "Northwest" and "Northeast", and the second row contains one cell, "South". The columns parameter on the south cell causes the cell to stretch across two columns, which is the entire width of the table in this case. This results in the table shown at right.
Rows and cells
Each <Table> tag must contain zero or more <row> tags as children. It may not directly contain any class tags, although certain special tags like <style> and <script> are permitted.
Each <row> tag must likewise contain zero or more <cell> tags. Each <cell> tag must contain one, and only one, component class tag.
As <Table> is ultimately backed by a GridBagLayout, each <cell> corresponds to a cell in the underlying GridBagLayout. Additionally, each <cell>, <row>, or even the <Table> itself may contain attributes corresponding to the various GridBagConstraints properties.
GridBagConstraints attributes
Each <cell>, <row>, or <Table> tag can have attributes corresponding to the properties of GridBagConstraints assigned to it. GridBagConstraints attributes on a cell apply only to the cell's component, while on a row or table they define default values that apply to all cells in the row or table.
| Attribute | Type | Description |
|---|---|---|
| columns | int | Number of grid columns this cell spans horizontally (equivalent to HTML colspan). columns is only valid on <cell> tags, not on rows or tables. |
| rows | int | Number of grid rows this cell spans vertically (equivalent to HTML rowspan). rows is only valid on <cell> tags, not on rows or tables. |
| insets | java.awt.Insets | Four comma-separated numbers specifying the top, left, bottom, and right insets (or only one number if all four should be the same). |
| weightx | float | Proportion of extra horizontal space that should be allocated to this cell. |
| weighty | float | Proportion of extra vertical space that should be allocated to this cell. |
| anchor | enumeration | Position of the component within the cell. Must be one of north, northeast, east, southeast, south, southwest, west, northwest, or center. |
| fill | enumeration | How this component should be resized when its cell changes size. Must be none (do not change size), horizontal (change size horizontally only), vertical (change size vertically only), or both (change size in both directions). |


