// This sample shows how to create table cells that span several
  // rows and columns, and how to designate some rows as headers

  // Create a table
  TableNode table = diagram.getFactory().createTableNode(10, 10, 50, 40);

  // Setup the number of rows and columns in the table
  table.redimTable(2, 5);

  // Mark the first and the fourth rows as headers
  table.getRows().get(0).setHeader(true);
  table.getRows().get(3).setHeader(true);

  // Span the cells in the header rows to cover the entire rows
  table.getCell(0, 0).setColumnSpan(2);
  table.getCell(0, 0).setText("Header 1");
  table.getCell(0, 3).setColumnSpan(2);
  table.getCell(0, 3).setText("Header 2");

  // Span the cells from the second column below the first header row
  table.getCell(1, 1).setRowSpan(2);
  table.getCell(1, 1).setText("span");

  // Offset the header rows, so that the 'expand/collapse'
  // icon is positioned to the left of the cells
  table.setOffsetHeaderRows(true);