Ho trovato una soluzione abbastanza valida senza dovermi appoggiare ad ulteriori librerie! e la soluzione è il seguente spezzone di codice:
codice:
EasyParser.edit.setContentType("text/html");
EasyParser.edit.setEditable(false);
// aggiungo un HTMLEditorKit all editor pane
HTMLEditorKit kit = new HTMLEditorKit();
EasyParser.edit.setEditorKit(kit);
EasyParser.scroll = new JScrollPane(EasyParser.edit, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
EasyParser.scroll.setBounds(10, 10, 990, 580);
// aggiungo gli stili al foglio html
StyleSheet styleSheet = kit.getStyleSheet();
styleSheet.addRule("body{background-color: #ffffff;}");
styleSheet.addRule("th{font-family: Arial;font-size: 7px;}");
styleSheet.addRule("td{font-family: Arial;font-size: 9px;}");
// creo un documento, setto il jeditor pane e aggiungo html
Document doc = kit.createDefaultDocument();
EasyParser.edit.setDocument(doc);
EasyParser.edit.setText(tabella);
EasyParser.edit.setEditable(false);
Ora mi rimane un ultimo dubbio. ho dovuto parsare una pagina html che contiene circa 1600 righe e la parsa tranquillamente, ma quando deve andare a visualizzarla nel JEditorPane mi dà l'errore di heap space!! però la JVM non ha raggiunto il livello massimo anzi tutt'altro!
Cosa può essere?