Here you can find the source of hasRows(JTable table)
public static boolean hasRows(JTable table)
//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; } }