Example usage for javax.swing.table AbstractTableModel getRowCount

List of usage examples for javax.swing.table AbstractTableModel getRowCount

Introduction

In this page you can find the example usage for javax.swing.table AbstractTableModel getRowCount.

Prototype

public int getRowCount();

Source Link

Document

Returns the number of rows in the model.

Usage

From source file:com.peadargrant.filecheck.web.reports.WebTableTransformer.java

public List getTableContents(AbstractTableModel model) {
    int nRows = model.getRowCount();
    int nCols = model.getColumnCount();

    List<List> rows = new ArrayList<>();
    for (int iRow = 0; iRow < nRows; iRow++) {
        List<Object> row = new ArrayList<>();

        for (int iCol = 0; iCol < nCols; iCol++) {
            Object output = model.getValueAt(iRow, iCol);
            if (String.class.isInstance(output)) {
                output = HtmlUtils.htmlEscape((String) output);
            }//from   www  .  java  2  s  .c o  m
            row.add(output);
        }

        rows.add(row);
    }

    return rows;
}