JEditorPane on Steroids with Nashorn
Posted
by Geertjan
on Oracle Blogs
See other posts from Oracle Blogs
or by Geertjan
Published on Thu, 29 Nov 2012 09:31:02 +0000
Indexed on
2012/11/29
11:15 UTC
Read the original article
Hit count: 236
/NetBeans IDE
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:
http://java.net/projects/nb-api-samples/sources/api-samples/show/versions/7.3/misc/CMSBackOffice2
© Oracle Blogs or respective owner