Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

the Caret height is not relative to the font size

843806Nov 20 2007 — edited Nov 20 2007
I am using a JTextPane - as a RTF editor - where it is possible to change the fonts (size, family .. etc.). The dafault fontsize is 12.

When I increase the fontsize I update the "+StyleConstants.FontSize+" attribute, and everything works fine: the cursor height increases to fit the new font size.

Everything works fine as long as i don't change the font size to be LESS than the DEFAULT value (12).
In this case the cursor (caret ?) height does not get smaller. More precisely, if I change the font size to be 6, the text will be smaller, but the cursor height will remain the same as the one used by font size 12. So the text is displaced to the bottom.

any idea why the cursor does not resize when the font size is less than the default?? As the line (row) height depends upon the cursor hieght the text will always be displaced.

thank you (~_~)

think it has something to do with the DefaultStyledDocument.insertUpdate(DefaultDocumentEvent a_event, AttributeSet a_attr) method but i am not sure...
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 18 2007
Added on Nov 20 2007
2 comments
276 views