Writes all the text in this TextPanel to a file.
(PrintWriter pw)
| 1035 | |
| 1036 | /** Writes all the text in this TextPanel to a file. */ |
| 1037 | public void save(PrintWriter pw) { |
| 1038 | resetSelection(); |
| 1039 | if (labels!=null && !labels.equals("")) { |
| 1040 | String labels2 = labels; |
| 1041 | if (saveAsCSV) |
| 1042 | labels2 = labels2.replaceAll("\t",","); |
| 1043 | pw.println(labels2); |
| 1044 | } |
| 1045 | for (int i=0; i<iRowCount; i++) { |
| 1046 | char[] chars = (char[])(vData.elementAt(i)); |
| 1047 | String s = new String(chars); |
| 1048 | if (s.endsWith("\t")) |
| 1049 | s = s.substring(0, s.length()-1); |
| 1050 | if (saveAsCSV) |
| 1051 | s = s.replaceAll("\t",","); |
| 1052 | pw.println(s); |
| 1053 | } |
| 1054 | unsavedLines = false; |
| 1055 | } |
| 1056 | |
| 1057 | /** Saves the text in this TextPanel to a file. Set 'path' to "" to |
| 1058 | * display a "save as" dialog. Returns 'false' if the user cancels |
no test coverage detected