This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

Class

Table

Name

addRow()

Examples
Table table;

void setup() {

  table = new Table();
  
  table.addColumn("name");
  table.addColumn("type");
  
  TableRow newRow = table.addRow();
  newRow.setString("name", "Lion");
  newRow.setString("type", "Mammal");
  println(table.getRowCount());  // Prints 1
  
  table.addRow();  // Creates a new blank row
  println(table.getRowCount());  // Prints 2
  
  table.addRow(newRow);  // Duplicates newRow
  println(table.getRowCount());  // Prints 3
}
Description Use addRow() to add a new row of data to a Table object. By default, an empty row is created. Typically, you would store a reference to the new row in a TableRow object (see newRow in the example above), and then set individual values using setInt(), setFloat(), or setString(). If a TableRow object is included as a parameter, then that row is duplicated and added to the table.
Syntax
.addRow()
.addRow(source)
Parameters
source TableRow: a reference to the original row to be duplicated
ReturnsTableRow
RelatedremoveRow()
clearRows()
Updated on January 1, 2021 03:38:10am EST