Effiecient method to get number of lines in a JEditorPane
My Computer Science class has a major grade project to complete by Dec. 15. For my project I've decided to make a tabbed Java IDE with save, open, compile, run, and some font options. Due to the need to make Java use the command prompt to compile and run, it will be Windows specific.
Now, next to my JEditorPane I want to put a JPanel with a GridLayout full of JLabels that will hold the line numbers. I'm having a small problem getting the precise number of lines though. Due to the nature of JEditorPane, I can't just count the number of newline characters in the JEditorPane. I've tried to use a Scanner to go through the text and find all instances of the string "<p style=\"margin-top: 0\">" but because the JEditorPane doesn't make a new
tag until text is entered into a new line, this only works some of the time.
Does anyone know of a way I can effectively and efficiently find the number of lines in the JEditorPane at any given time?
Message was edited by:
TheGuy@YourWindow

