List of utility methods to do JTable Row
Object[] | getNullRow(TableModel tm) get Null Row Object[] row = new Object[tm.getColumnCount()]; return row; |
int | getReadableRow(JTable table, int maximumHiddenPart) get Readable Row Rectangle visibleRect = table.getVisibleRect(); Point leadingPoint = getLeadingPoint(table, visibleRect); int row = table.rowAtPoint(leadingPoint); int column = table.columnAtPoint(leadingPoint); if (leadingPoint.y - table.getCellRect(row, column, true).getY() <= maximumHiddenPart) { return row; } else { return Math.min(row + 1, table.getRowCount() - 1); ... |
int | getRealRowPos(int rowPos, JTable table) get Real Row Pos if (rowPos == -1) { return rowPos; if (table.getRowSorter() == null) { return rowPos; int fixRowPos = table.getRowSorter().convertRowIndexToModel(rowPos); return fixRowPos; ... |
Rectangle | getRowBounds(JTable table, int first, int last) get Row Bounds Rectangle result = table.getCellRect(first, -1, true);
result = result.union(table.getCellRect(last, -1, true));
Insets i = table.getInsets();
result.x = i.left;
result.width = table.getWidth() - i.left - i.right;
return result;
|
int | getRowByValue(TableModel model, Object value) get Row By Value for (int i = model.getRowCount() - 1; i >= 0; --i) { for (int j = model.getColumnCount() - 1; j >= 0; --j) { if (model.getValueAt(i, j).equals(value)) { return i; return 0; ... |
Object[] | getTableRow(TableModel tableModel, int row) Returns all cell values of a given table row ordered by their column indexes. int columnCount = tableModel.getColumnCount(); Object[] rowData = new Object[columnCount]; for (int ct = 0; ct < columnCount; ct++) rowData[ct] = tableModel.getValueAt(row, ct); return rowData; |
boolean | hasRows(JTable table) has Rows TableModel model = table.getModel(); if ((model.getRowCount() > 0) && (!firstRowIsVoid(model))) { return true; return false; |
void | insertRow(final JTable table, final int index, Object... data) insert Row ((DefaultTableModel) table.getModel()).insertRow(index, data); |
boolean | isFirstToLastRow(TableModelEvent e) is First To Last Row return e.getFirstRow() == 0 && e.getLastRow() == MAX_VALUE;
|
boolean | isRowInsert(TableModelEvent e) is Row Insert return (e.getType() == TableModelEvent.INSERT && e.getFirstRow() >= 0);
|