setLayout(new BorderLayout());
jepMessage = new JosmEditorPane("text/html", "");
jepMessage.setOpaque(false);
jepMessage.setEditable(false);
Font f = UIManager.getFont("Label.font");
StyleSheet ss = new StyleSheet();
String rule = MessageFormat.format(
"font-family: ''{0}'';font-size: {1,number}pt; font-weight: {2}; font-style: {3}",
f.getName(),
f.getSize(),
f.isBold() ? "bold" : "normal",
f.isItalic() ? "italic" : "normal"
);
rule = "body {" + rule + "}";
rule = MessageFormat.format(
"font-family: ''{0}'';font-size: {1,number}pt; font-weight: {2}; font-style: {3}",
f.getName(),
f.getSize(),
"bold",
f.isItalic() ? "italic" : "normal"
);
rule = "strong {" + rule + "}";
ss.addRule(rule);
ss.addRule("a {text-decoration: underline; color: blue}");
ss.addRule("ul {margin-left: 1cm; list-style-type: disc}");
JosmHTMLEditorKit kit = new JosmHTMLEditorKit();
kit.setStyleSheet(ss);
jepMessage.setEditorKit(kit);
add(jepMessage, BorderLayout.CENTER);