JEditorPane on Steroids with Nashorn

Continuing from Embedded Nashorn in JEditorPane, here is the same JEditorPane on steroids with Nashorn, in the context of some kind of CMS backend system:

Above, you see heavy reusage of NetBeans IDE editor infrastructure. Parts of it are with thanks to Steven Yi, who has done some great research in this area. Code completion, right-click popup menu, line numbering, editor toolbar, find/replace features, block selection, comment/uncomment features, etc, etc, etc, all the rich editor features from NetBeans IDE are there, within a plain old JEditorPane. And everything is externally extensible, e.g., new actions can be registered by external modules into the right-click popup menu or the editor toolbar or the sidebar, etc.

For example, here's code completion (Ctrl-Space):

It even has the cool new feature where if you select a closing brace and the opening brace isn't in the visible area, a rectangular popup appears at the top of the editor, to show how the current piece of code begins:

The only thing I am missing is code folding! I wish that would work too, still figuring it out.

What's also cool is that this is a Maven project. The sources:



I'm trying to learn how to drag and drop in Netbeans, but haven't had any success. I found your article, but the links are broken. Any suggestions on where I could find some help?

Thank you!

Posted by guest on November 30, 2012 at 09:55 AM PST #

What on earth does "drag and drop in Netbeans" mean? You need to be very specific about what you want to achieve, otherwise I'm going to ignore your comments completely. Also, this has nothing at all to do with this blog entry -- so either leave your comments underneath the relevant blog entry or do the normal thing: write to the mailing list.

Posted by Geertjan on November 30, 2012 at 04:27 PM PST #


May I know what is the API for popup window showing javadoc/jsdoc (in figure of "code completion (Ctrl-Space):")?

I am interested to use that feature for on screen help in my NetBeans platform application.


Posted by huionn on December 04, 2012 at 11:22 PM PST #

I found out that it is in "Editor Code Completion" library by implementing CompletionProvider and handle queryType == CompletionProvider.DOCUMENTATION_QUERY_TYPE.

Posted by huionn on December 06, 2012 at 02:47 AM PST #

And here's the tutorial, from the NetBeans Platform Learning Trail:

Posted by Geertjan on December 06, 2012 at 02:50 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« June 2016