1

I'm using a JTextPane with a HTMLDocument inside to read and write HTML via HTMLEditorKit. Everything works quite fine, except that the wonderful full-conform W3C HTML5 I'm putting inside is then written in an ugly, deprecated, obsolete HTML3.2...

So, I looked into the code of java.swing.text.html.HTMLWriter, and I discovered this :

    if (writeCSS) {
        convertToHTML40(from, to);
    } else {
        convertToHTML32(from, to);
    }

So I thought that I was saved, and a simple setWriteCSS(true) would make me get a much better result... Except that writeCSS is private and there is no setter to modify its value :

    private boolean writeCSS = false;

I always knew that Sun people were funny guys... Anyway, I could have just override the current convert method, but the final HTML is still not wonderful.

I'm sure there are somewhere people facing this issue and that wrote their own HTMLWriter. I just can't find any. Could anyone indicate me one ?

Thanks a lot !

Sharcoux
  • 5,546
  • 7
  • 45
  • 78
  • current Java versions support up to Html & css 3.2 (reduced for css), have to test how is accesible JavaFX API from Swing or use embeded JavaFX in Swing – mKorbel Nov 21 '13 at 19:32
  • Thanks. I tried this approach, but renounced. I couldn't figure out clearly how to transform a Swing app into an FX one without spending night and day adapting code and correcting bugs. Moreover I just need the HTMLWriter. I thought it would be easy to find... – Sharcoux Nov 21 '13 at 21:20

0 Answers0