Abhay Abhay - 4 months ago 11x
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 ?


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.