Here you can find the source of getTableRow(TableModel tableModel, int row)
Parameter | Description |
---|---|
tableModel | The <code>TableModel</code> from which the cell values should be read. |
row | Index of the row that should be processed. |
Object
s, where each index corresponds to the tableModel
's column index and each value is the corresponding cell value.
public static Object[] getTableRow(TableModel tableModel, int row)
//package com.java2s; /*//from w ww . j a v a 2 s . co m * SalSSuite - Suite of programmes for managing a SalS project * Copyright (C) 2011 Jannis Limperg <jannis[dot]limperg[at]arcor[dot]de> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import javax.swing.table.TableModel; public class Main { /** * Returns all cell values of a given table row ordered by their column * indexes. * @param tableModel The <code>TableModel</code> from which the cell values should * be read. * @param row Index of the row that should be processed. * @return An array of <code>Object</code>s, where each index corresponds * to the <code>tableModel</code>'s column index and each value is the * corresponding cell value. */ public static Object[] getTableRow(TableModel tableModel, int row) { int columnCount = tableModel.getColumnCount(); Object[] rowData = new Object[columnCount]; for (int ct = 0; ct < columnCount; ct++) rowData[ct] = tableModel.getValueAt(row, ct); return rowData; } }