Abhay Abhay - 1 year ago 98
Java Question

how to convert CaretEvent.getDot() to rectangular coordinates?

Actually i am trying to display the line number and coloumn number the user is currently typing in a JTextArea . My question is how can i convert CaretEvent.getDot() to rectangular coordinates so that i can achieve this ? Or is there any other method ?

Answer Source

Perhaps you're looking to use the JTextArea method, public Rectangle modelToView(int location). Actually this is a method from JTextArea's parent class, JTextComponent, and can help translate an int location in the document to the current rectangle location in the GUI itself, relative to the text component.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download