I'm looking for a method that computes the line number of a given text position in a JTextPane with wrapping enabled.
Example:
This a very very very very very very very very very very very very very very very very very very very very very very long line.
This is another very very very very very very very very very very very very very very very very very very very very very very long line.|
The cursor is on line number four, not two.
Can someone provide me with the implementation of the method:
int getLineNumber(JTextPane pane, int pos)
{
return ???
}