Creates a selection and insures it is visible.
(int startLine, int endLine)
| 982 | |
| 983 | /** Creates a selection and insures it is visible. */ |
| 984 | public void setSelection (int startLine, int endLine) { |
| 985 | if (startLine>endLine) endLine = startLine; |
| 986 | if (startLine<0) startLine = 0; |
| 987 | if (endLine<0) endLine = 0; |
| 988 | if (startLine>=iRowCount) startLine = iRowCount-1; |
| 989 | if (endLine>=iRowCount) endLine = iRowCount-1; |
| 990 | selOrigin = startLine; |
| 991 | selStart = startLine; |
| 992 | selEnd = endLine; |
| 993 | int vstart = sbVert.getValue(); |
| 994 | int visible = sbVert.getVisibleAmount()-1; |
| 995 | if (startLine<vstart) { |
| 996 | sbVert.setValue(startLine); |
| 997 | iY=iRowHeight*startLine; |
| 998 | } else if (endLine>=vstart+visible) { |
| 999 | vstart = endLine - visible + 1; |
| 1000 | if (vstart<0) vstart = 0; |
| 1001 | sbVert.setValue(vstart); |
| 1002 | iY=iRowHeight*vstart; |
| 1003 | } |
| 1004 | tc.repaint(); |
| 1005 | } |
| 1006 | |
| 1007 | /** Updates the vertical scroll bar so that the specified row is visible. */ |
| 1008 | public void showRow(int rowIndex) { |
no test coverage detected