schybert
asked on
Default Font in JEditPane
Hi all,
I'm going crazy trying to figure out how to set the default Font that a JEditPane should use. I'm using JEditPane as a TableCellEditor and TableCellRenderer, so even if I manage to set the Font used by the editor when inserting new text, I can't find a way to make the JEditPane use a specific Font when setting the text on an empty pane...
I'm using the StyledEditorKit (I need to be able to count the number of lines in the pane... even when they are wrapped).
I appreciate any help here...
I'm going crazy trying to figure out how to set the default Font that a JEditPane should use. I'm using JEditPane as a TableCellEditor and TableCellRenderer, so even if I manage to set the Font used by the editor when inserting new text, I can't find a way to make the JEditPane use a specific Font when setting the text on an empty pane...
I'm using the StyledEditorKit (I need to be able to count the number of lines in the pane... even when they are wrapped).
I appreciate any help here...
ASKER
Well, I have tried setFont actually :-) And as I said, I need to use the StyledEditorKit... not HTML.
okie
StyledEditorKit.FontFamily Action try this..
StyledEditorKit.FontFamily
ASKER
Yeah, but how do I use it? I need to execute the action explicity from within a method. An example would be very appreciated...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
OK, thanks. I don't have time to test this until tomorrow, so if if it solves my problem I'll accept your answer then.
ASKER
Well, I can do a workaround with this solution, but it's not really what I was aiming for... I have to execute the action each time I insert new text into the pane... What I was hoping to do was set the Font that will be used by the pane as default...
If you want to render something then you can also use the HTML tags for font. <font face="Arial'>hai</font>
That way you will get that font.