I have this code to display HTML formatted string:
JTextPane pane = new JTextPane();
pane.setContentType("text/html");
pane.setEditable(false);
pane.setText(
"<html>" +
"<body style='font-size:18px'>" +
"<h1>Error:</h1>" +
"<p>" +
"Could not read the file <code>none.txt</code>. " +
"Perhaps it does not exist in the specified location, " +
"or possibly there is no access to it" +
"</p>" +
"</body>" +
"</html>");
add(pane);
But this is the output:
You can see that the none.txt string doesn't inherit the font size of its enclosing paragraph, although this is what's supposed to happen in HTML (see jsfiddle).
How do I fix this?

<code>none.txt</code>from<body>should work, and how can we have more than one<body>? anyway, tried that, it completely ignores the whole content of<p>, and all I see is the "Error:" text.