(int column)
| 130 | } |
| 131 | |
| 132 | void calcAutoWidth(int column) { |
| 133 | if (tp.sColHead==null || column>=tp.iColWidth.length || gImage==null) |
| 134 | return; |
| 135 | if (fMetrics==null) |
| 136 | fMetrics=gImage.getFontMetrics(); |
| 137 | int w=15; |
| 138 | int maxRows = 20; |
| 139 | if (column==0 && tp.sColHead[0].equals(" ")) |
| 140 | w += 5; |
| 141 | else { |
| 142 | char[] chars = tp.sColHead[column].toCharArray(); |
| 143 | w = Math.max(w,fMetrics.charsWidth(chars,0,chars.length)); |
| 144 | } |
| 145 | int rowCount = Math.min(tp.iRowCount, maxRows); |
| 146 | for (int row=0; row<rowCount; row++) { |
| 147 | char[] chars = tp.getChars(column,row); |
| 148 | if (chars!=null) |
| 149 | w = Math.max(w,fMetrics.charsWidth(chars,0,chars.length)); |
| 150 | } |
| 151 | //System.out.println("calcAutoWidth: "+column+" "+tp.iRowCount); |
| 152 | char[] chars = tp.iRowCount>0?tp.getChars(column, tp.iRowCount-1):null; |
| 153 | if (chars!=null) |
| 154 | w = Math.max(w,fMetrics.charsWidth(chars,0,chars.length)); |
| 155 | if (column<tp.iColWidth.length) |
| 156 | tp.iColWidth[column] = w+15; |
| 157 | } |
| 158 | |
| 159 | } |
no test coverage detected