Almost always, I have got frustrated weith the JEditorPane. It's support ofr HTML is good (not the best.. dont try anything extravagant).. but it was not able to change the Font when i tried using setFont(). That was simply not working. After days of searching, googling and endless frustration , Sun java forums got me what I needed. HEre's how you do it:
Setting the HONOR_DISPLAY_PROPERTIES client property on the editor pane will allow you to use setFont and setBackground.
Like this:
JEditorPane pane = new JEditorPane();
pane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
pane.setFont(SOME_FONT);
That one line of code does the trick! I tried a Greek font and it worked!
No comments:
Post a Comment