Skip to main content

Using the Java Source Editor and Syntax highlight in any JEditorPane

Posted by edgars on January 17, 2007 at 10:52 AM PST

On the my new JSF Palette Components I've been doing, It allows users get any BackingBean (bean) from the Project, to make it possible, I was looking for on NetBeans Dev Wiki. And I get this entry: . However, I think this might works on NetBeans 6.0, cause doing like this entry says ...

EditorKit kit = CloneableEditorSupport.getEditorKit("text/x-java");
JEditorPane jep = new JEditorPane();

I in fact did not have success. But,
NetBeans Platform, offers great resources, as I did something similar to Greenbox for NetBeans , I did the following code for what I was needing:

      /** Creates new form JavaCodePanel */
    public JavaCodePanel() {
        EditorKit kit = JEditorPane.createEditorKitForContentType("text/x-java");

On the code the beanCode is a JEditorPane, and now this will have the same actions you can see on default Java Editor.

Look on the following image this component working:




Related Topics >>