Java JTable Row hasRows(JTable table)

Here you can find the source of hasRows(JTable table)

Description

has Rows

License

Open Source License

Declaration

public static boolean hasRows(JTable table) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import javax.swing.JTable;
import javax.swing.table.TableModel;

public class Main {
    public static boolean hasRows(JTable table) {
        TableModel model = table.getModel();
        if ((model.getRowCount() > 0) && (!firstRowIsVoid(model))) {
            return true;
        }/*from   w w w. ja  v  a  2s.c  o  m*/
        return false;
    }

    private static boolean firstRowIsVoid(TableModel model) {
        boolean isVoid = true;
        for (int colIndex = 0; colIndex < model.getColumnCount(); colIndex++) {
            if (model.getValueAt(0, colIndex) == null) {
                isVoid = true;
            } else {
                isVoid = false;
                break;
            }
        }
        return isVoid;
    }
}

Related

  1. getReadableRow(JTable table, int maximumHiddenPart)
  2. getRealRowPos(int rowPos, JTable table)
  3. getRowBounds(JTable table, int first, int last)
  4. getRowByValue(TableModel model, Object value)
  5. getTableRow(TableModel tableModel, int row)
  6. insertRow(final JTable table, final int index, Object... data)
  7. isFirstToLastRow(TableModelEvent e)
  8. isRowInsert(TableModelEvent e)
  9. jtable$convertRowIndexToModel(JTable table, int index)