Java examples for Swing:JTable Row
get Row Value from JTable
//package com.java2s; import javax.swing.JTable; public class Main { public static String getRowValue(JTable table, int[] rows, Object nullValue) {/*www .j a v a 2s .c o m*/ String content = ""; if (table == null) return content; int colTotal = table.getColumnCount(); if (rows == null) rows = table.getSelectedRows(); Object tmp; for (int i : rows) { for (int j = 0; j < colTotal; j++) { tmp = table.getValueAt(i, j); content += (tmp == null ? nullValue : tmp + "\t"); } content += "\n"; } return content; } public static String getRowValue(JTable table, Object nullValue) { return getRowValue(table, null, nullValue); } public static String getRowValue(JTable table) { return getRowValue(table, ""); } }