MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / setSelection

Method setSelection

ij/src/main/java/ij/text/TextPanel.java:984–1005  ·  view source on GitHub ↗

Creates a selection and insures it is visible.

(int startLine, int endLine)

Source from the content-addressed store, hash-verified

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) {

Callers 1

findMethod · 0.95

Calls 4

getVisibleAmountMethod · 0.80
getValueMethod · 0.45
setValueMethod · 0.45
repaintMethod · 0.45

Tested by

no test coverage detected