How to reuse XML syntax highlighting in your own editor

Apache NetBeans Wiki Index

Note: These pages are being reviewed.

If you don’t want to open or edit your data in a new editor TopComponent, but you still want to have nice syntax coloring in your own editor, you can get the EditorKit for the mime type and reuse it in your own JEditorPane.

For example, if you want to nicely display some XML in your own JEditorPane then first make sure all the required modules are loaded then:

String mime = "text/xml";
EditorKit ek = CloneableEditorSupport.getEditorKit(mime);

And you will get nice syntax coloring. However you won’t get line numbers and other editing facilities since they are not provided by the EditorKit.