3

If you change the editor kit of a JEditorPane to HTMLEditorKit, how do you change it back to the default (plain text) editor kit, like how it is when you first instantiate one? I want it to do this so that I can load all of the html and display it as plain text, not as formatted text, when the user switches to html mode (I'm making a dreamweaver-type app). I tried:

DefaultEditorKit kit = new DefaultEditorKit();
page.setEditorKit(kit);

But that makes the editor pane uneditable. How can I switch the editor kit back to plain text?

mKorbel
  • 109,525
  • 20
  • 134
  • 319
Jutanium
  • 421
  • 3
  • 16

1 Answers1

3

As discussed in Editor Panes vs. Text Panes, "Be aware that the document and editor kit might change when using the setPage() method." For plain text, they recommend a DefaultStyledDocument and StyledEditorKit.

trashgod
  • 203,806
  • 29
  • 246
  • 1,045