Reputation: 31
I have task to implement HTML renderer. That's ok, i have used javax.swing.text.html.HTMLDocument
.
Now i have to implement custom view for HTML tags:
<u>
- wavy underline<b>
- usual bold style + text shadowI've tried:
pane = new JTextPane();
pane.setEditable(false);
add(new JScrollPane(pane));
StyledEditorKit kit = new HTMLEditorKit() {
public Document createDefaultDocument() {
HTMLDocument doc = new CustomHTMLDocument(getStyleSheet());
StyleSheet sheet = doc.getStyleSheet();
sheet.addRule("b {text-shadow: #6374AB 14px -6px 2px; }");
return doc;
}
};
pane.setEditorKit(kit);
But this doesn't work. Can anybody help me with this ?
Upvotes: 2
Views: 759
Reputation: 168825
Swing's HTML/CSS rendering is extremely basic. I am not surprised that it supports neither of the 'wavy underline' nor 'text shadow'.
Upvotes: 1
Reputation: 57381
Try this to add your own custom tag in the HTMLEditorKit http://java-sl.com/custom_tag_html_kit.html
Upvotes: 1