Here you can find the source of getContent(JTable table, String lineBreak, String cellBreak, int columnCount, int rowCount, int[] selectedRowsCount, int[] selectedColumsCount)
private static String getContent(JTable table, String lineBreak, String cellBreak, int columnCount, int rowCount, int[] selectedRowsCount, int[] selectedColumsCount)
//package com.java2s; //License from project: LGPL import java.util.logging.Logger; import javax.swing.JTable; public class Main { private static Logger logger = Logger.getLogger("uk.ac.starlink.splat.util.JTableUtilities"); private static String getContent(JTable table, String lineBreak, String cellBreak, int columnCount, int rowCount, int[] selectedRowsCount, int[] selectedColumsCount) { if (columnCount > 0 && rowCount > 0) { StringBuffer value = new StringBuffer(); for (int i = 0; i < rowCount; i++) { for (int j = 0; j < columnCount; j++) { value.append(escapeContentBreaks(table.getValueAt(selectedRowsCount[i], selectedColumsCount[j]), lineBreak, cellBreak)); if (j < columnCount - 1) { value.append(cellBreak); }/*w w w. j a v a2 s .com*/ } value.append(lineBreak); } return value.toString(); } else { logger.warning("Invalid selection."); return null; } } private static String escapeContentBreaks(Object cell, String lineBreak, String cellBreak) { return cell == null ? "" : cell.toString().replace(lineBreak, " ").replace(cellBreak, " "); } }