List of utility methods to do JTextComponent Row
int | getRow(int pos, JTextComponent editor) get Row int rn = (pos == 0) ? 1 : 0; int offs = pos; while (offs > 0) { offs = Utilities.getRowStart(editor, offs) - 1; rn++; return rn; |
int | getRow(JTextComponent editor, int pos) get Row int rn = (pos == 0) ? 1 : 0; try { int offs = pos; while (offs > 0) { offs = Utilities.getRowStart(editor, offs) - 1; rn++; } catch (BadLocationException e) { ... |
int | getRowStart(JTextComponent c, int offs) Determines the starting row model position of the row that contains the specified model position. Rectangle r = c.modelToView(offs); if (r == null) { return -1; int lastOffs = offs; int y = r.y; while ((r != null) && (y == r.y)) { offs = lastOffs; ... |