Table with colspan/rowspan


I would like to be able to visualize a table with colspan/rowspan.
I looked at the Table class but did not found this feature.
I then detected GridLayout. There is even an example in the manual how to activate borders etc. However when trying to set colors for the single cells, I had to use setFullSize() on them which got quite complicated and led to some anomalies in rendering.

So I thought I would rather ask whether there is an easy way which I have not yet detected. What would you suggest to achieve the following:

  • render a table where
  • a region can occupy NxN cells (colspan/rowspan) and displays some text
  • each region can have a background color of its choice
  • borders can be set for any regions

What would you propose?


I recently had about the same issue. I had a table, but it needed to have four different types of rows in it - every one being shown in a little different structure.

What I did was I made a CustomComponent of a row. This custom row had four different rendering possibilities, and it took an enum in the constructor telling the type of row. The “table” itself is now a vertical layout, and every row in it is basically a horizontal layout - which tells how wide every cell in row should be (colspan).

This obviously doesn’t work directly, without tweaking, for rowspan too, but it filled all the Criteria in my case.

Best luck,