Problems with displaying CSS in JEditorPane

C

Christian Marko

Hi to all!

I have the following problem:
I want to import an external CSS-file but the defined color of the
styles are not displayed (always black is taken).

Does anyone can give me a hint, why this problem occurs?

As I read in the documentation, the attributes white-space and
text-indent are not rendered. Does anyone know a workaround, because
these attributes are also defined in the CSS-file I got?

Example:

JEditorPane pane = new JEditorPane();

try
{
pane.setPage(getClass().getResource("/myHtmlFile.htm"));
}
catch (Exception e)
{
e.printStackTrace();
}

StyleSheet ss = ((HTMLDocument)pane.getDocument()).getStyleSheet();
try
{
styles.importStyleSheet(getClass().getResource("/myCSSFile.css"));
}
catch (Exception e)
{
e.printStackTrace();
}


thx
Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,002
Messages
2,570,261
Members
46,858
Latest member
FlorrieTuf

Latest Threads

Top