A JEditorPane is for displaying HTML.
You should be using a JTextArea if you are showing plain text or JTextPane if you are using text with attributes.
JTextArea has a get line height method.
JTextPane doesn't have a method but you can get the font of the JTextPane and then get the FontMetrics of the Font and then get the line height information from the metrics.
I use JEditorPane because c source code is not plain text.I insert html in it ,for keyword highlight.
The question is that FontMetrics does not work.
my code is :
jEditorpane.getFontMetrics(jEditorpane.getFont());
but the actual font is : <font size="..">...</font>.
> but the actual font is : <font size="..">...</font>.
Well you shouldn't be changing the font size of the text. Editors should just highlight keywords not change the size.
> I insert html in it ,for keyword highlight.
I would use a JTextPane then. Its easier to use attributes than to play with HTML. Simple example:
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=342068
> >I use JEditorPane because c source code is not plain
> text.
>
> have you ever seen a .c or .cpp file? what kind of
> file do you think is it? does .c or .cpp stores all
> font information? how do you make this kind of
> statements in a public forum ?
I know that .c is plain text,does not store font information.I wnat to highlight keyword.I add font information for it.