OCPJP 6
[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
OCPJP 6
Translates an offset into the components text to a line number.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Fred Hamilton wrote:if you know the width in characters of your text area (I believe that is not difficult to find out)
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Prime wrote:
Fred Hamilton wrote:if you know the width in characters of your text area (I believe that is not difficult to find out)
Unfortunately, for most fonts there is no uniform width for characters. Therefore, a line with many w's will contain fewer characters than a line with many i's.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Prime wrote:How about getLineOfOffset?
Translates an offset into the components text to a line number.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Camick wrote:These Text Utilities should help.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Fred Hamilton wrote:And your remark Also, the getColumnAtCaret() method only makes sense when using a Monospaced font. nicely articulates what I was thinking with getColumns() of JTextArea.
This tiny ad is wafer thin:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|