Geertjan's Blog

  • November 29, 2012

JEditorPane on Steroids with Nashorn

Geertjan Wielenga
Product Manager

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:


Join the discussion

Comments ( 5 )
  • guest Friday, November 30, 2012


    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!

  • Geertjan Saturday, December 1, 2012

    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 dev@platform.netbeans.org mailing list.

  • huionn Wednesday, December 5, 2012


    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.


  • huionn Thursday, December 6, 2012

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

  • Geertjan Thursday, December 6, 2012

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


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha