Line Highlighting in a JTextPane/JEditorPane with a text file as an input
Posted on 2004-09-08
Just as in any Java IDE (JBuilder, eclipse) when you compile a class, you get errors listed below in a table format; when you click one of the rows in the table, the error is highlighted in the above editor in the corresponding line.
I have a similar requirement.
I have created a tableModel for errors & I can capture the line no in the text file (although the line no is not explicitly mentioned in the text file). I just need a very basic editor (very very basic) which shows cobol code in it & when onClick on the table, should traverse to the exact line no highlighting the entire LINE.
1) how to interpret lines in a TextPane/EditorPane & sucessfully jump to line nos?
(Im dealing with 100's of lines of text file, so loading into a string array oR JList will reduce the perf)
2)how to highlight the entire line, once i know the line no?
Can anybody suggest how to go about this??
So far, Ive tried adding CaretListener's but it aint working.