Java Utililty Methods JTextComponent Row

List of utility methods to do JTextComponent Row

Description

The list of methods to do JTextComponent Row are organized into topic(s).

Method

intgetRow(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;
intgetRow(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) {
...
intgetRowStart(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;
...