• 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.setContentType("text/java");
          editor.setBackground(Color.white);
          editor.setFont(new Font("Courier", 0, 12));
          editor.setEditable(true);



Here are the web sites where I got all the codes…
http://www.developer.com/java/other/article.php/3318421
http://java.sun.com/products/jfc/tsc/articles/text/editor_kit/
0
csound
Asked:
csound
1 Solution
 
aozarovCommented:
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.
0

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