List used to display the set of values get from jtable where as the output results in delimited format of comma separated. For example [data1,data2,data3,data4], this is how the list produces output result. I tried replacing comma into space delimiter of the parameters in arraylist but it replaces all the comma into spaces.
My Code:
List<String> colValues = new ArrayList<String>();
for (int i = 0; i < jTable1.getRowCount(); i++)
{
for(int j=0;j<jTable1.getRowCount();j++)
{
colValues.add((String) jTable1.getValueAt(i, j));
}
}
String s1 = colValues.toString();
JOptionPane.showMessageDialog(null, s1.replace("[", "(").replace("]", ")").replace(","," "));
Output:
I need to display the records of a row in space delimiter and after the row is printed, the comma delimiter should be used. For example of image screenshot (abc item1,xyz item2), suggest me a solution to do like this example. The scenario is to print output in a single line, suggest me a solution.
Thanks