The list of methods to do JTextComponent Row are organized into topic(s).
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;
...