• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 407
  • Last Modified:

Installing two EditorKit into JEditor Pane

Is it possible to install more than one EditorKit into JEditorPane.

I want to install a EditorKit that displays line numbers and a EditorKit which highlights the Java key words.
If I try to install two Editor kit one of them would not work…

          JEditorPane editor = new JEditorPane();
            editor.setEditorKit(new NumberedEditorKit());
          JavaEditorKit kit = new JavaEditorKit();
          editor.setEditorKitForContentType("text/java", kit);
          editor.setFont(new Font("Courier", 0, 12));

Here are the web sites where I got all the codes…
1 Solution
The EditorKit that will be used/active is based on the content value that the editor was set with.
Having editor.setContentType("text/java"); will cause the JavaEditorKit to be active.
I don't think you can make two EditorKit active at the same time.

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now