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); editorPane.setEditorKit(ek); editorPane.setContentType(mime); editorPane.setText(xml);
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.
Apache Migration Information
The content in this page was kindly donated by Oracle Corp. to the Apache Software Foundation.
This page was exported from http://wiki.netbeans.org/DevFaqEditorHowToReuseEditorHighlighting , that was last modified by NetBeans user Jmborer on 2013-09-27T09:13:03Z.
NOTE: This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed.