I'm trying to use j2html to produce simple tables for displaying in Swing's TextPanes.
I want borders on the table, but I can't figure out how to add the border=1
attribute to the <table>
tag (as far as I know, css styles don't work in TextPane).
attrs("border=1")
throws an exception, and withData("border", "1")
does nothing.
return body(
table(
tbody(
each(this.DATA, (k,v) -> tr(
td(k.toString()),
td(rawHtml(v.toLink()))
))))).toString();
One way of doing this is by adding
attr("border", "1")
to the table, like so:I haven't tried CSS on the
JTextPane
though.Another way of doing this (which needs a bit more code, but has prettier result) is:
Both cases are not using CSS.