dcaoyuan/nbscala — Issue #31: Question: Use syntax highlighting in custom jEditorPane
Author: ralfe
Created: 2012-02-09 12:03:51+00:00
State: open

Hi,

is there a way to use the scala syntax highlighting in a custom jEditorPane. With java i could do some:

````java
EditorKit kit = CloneableEditorSupport.getEditorKit("text/java");
editorPane.setEditorKit(kit);

FileObject fob;
try {
fob = FileUtil.createMemoryFileSystem().getRoot().createData("tmp", "java");
DataObject dob = DataObject.find(fob);
editorPane.getDocument().putProperty(
Document.StreamDescriptionProperty,
dob);
DialogBinding.bindComponentToFile(fob, 0, 0, editorPane);
editorPane.setText("package test;");
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
````

My use case is that i need just some simple textComponent that renders some scala code with pretty syntax.

Any hints how to do that?

Cheers
Ralf