NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Editor Java in a JEditorPane

Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message

Joined: 29 Jul 2010
Posts: 13

PostPosted: Wed Dec 15, 2010 11:27 pm    Post subject: Editor Java in a JEditorPane Reply with quote


I fail in getting syntax highlighting and completion in a JEditorPane. I include the classical following code:

        JEditorPane editorPane = new JEditorPane();
        EditorKit kit = CloneableEditorSupport.getEditorKit("text/x-groovy");
        FileObject fob;
        try {
            fob = FileUtil.createMemoryFileSystem().getRoot().createData("tmp",
            DataObject dob = DataObject.find(fob);
      DialogBinding.bindComponentToFile(fob, 0, 0, editorPane);
            editorPane.setText("package dummy;");
        } catch (IOException ex) {

It fails giving the following error:

at org.netbeans.modules.parsing.impl.DialogBindingEmbeddingProvider.getEmbeddings(
at org.netbeans.modules.parsing.impl.SourceCache.refresh(
at org.netbeans.modules.parsing.impl.TaskProcessor$
at java.util.concurrent.Executors$
at java.util.concurrent.FutureTask$Sync.innerRun(
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
at java.util.concurrent.ThreadPoolExecutor$

The error just occurs at the moment of the binding. If I comment DialogBinding.bindComponentToFile(fob, 0, 0, editorPane), I don't have any exception and I get a simple editor (with the red margin in the right hand side) but without any highlight syntax nor completion.
The behavior is the same using java or groovy binding. An idea of what is wrong ?

One more thing, the list of imports:


import javax.swing.text.Document;
import javax.swing.text.EditorKit;
import org.netbeans.api.editor.DialogBinding;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
import org.openide.loaders.DataObject;
import org.openide.text.CloneableEditorSupport;

Thanks for helping.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum

Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo