meglio usare il jeditorpane senza sottoclassarlo
in pratica devi sostituire il testo che scrive l'utente con un codice html, penso funzioni
codice:
public class EditorHtml {
JEditorPane pane;
public EditorHtml() {
pane = new JEditorPane("text/html");
frame.add(pane);
pane.addKeyListener(new kl());
}
class kl implements KeyListener {
String buffer = "";
public void keyPressed(KeyEvent e) {}
public void keyReleased(KeyEvent e) {}
public void keyTyped(KeyEvent e) {
buffer += e.getKeyChar();
pane.setText("<html><body>" + buffer + "</body></html>");
// istruzioni per stile
}
}
}