« Java Posse Roundup... | Main | JavaFX Text Componen... »

20090316 Monday March 16, 2009

NetBeans Screenshot of the Week 42: JavaScript Native Interface

At the Roundup last week I talked to Robert Cooper, who's doing a lot of interesting work with GWT (Google Web Toolkit). In GWT (which compiles Java to JavaScript), you can embed JavaScript directly within the Java files inside comments with special markers. Robert mentioned that IntelliJ has a nice feature for GWT programmers where your native JavaScript snippets get JavaScript highlighting etc.

I figured that would be a trivial thing to add to NetBeans with our language embedding infrastructure. Sure enough, the patch just adds 13 lines of code. Here's a screenshot - showing JavaScript (regular expressions etc) inside Java code (with packages etc) - it's inside comments that start and end with -{ and }-:

If you want this functionality in your own 7.0 build, just download this module nbm, or apply the patch to your own build.

(2009-03-16 10:37:17.0) Permalink Comments [6]

Comments:

7.0 or 6.7?

I'm confused by version numbers these days... ;-)

Posted by Tim Yates on March 16, 2009 at 11:32 AM PDT #

Doh, I meant 6.7. We originally planned a 7.0 but then switched to a model with shorter releases. I -think- the plan is for 6.7 to be out in about three months.

Posted by Tor Norbye on March 16, 2009 at 11:42 AM PDT #

Hehe, just keeping you on your toes ;-) Looking really nice :-)

Posted by Tim Yates on March 16, 2009 at 12:46 PM PDT #

oh, I like that... :-)

That'll make editing of GWT files a first class experience.

Does anyone know why google appears to favour eclipse ? see http://code.google.com/webtoolkit/gettingstarted.html They do not appear to mention NB at all.

Posted by Nigel Leck on March 16, 2009 at 10:37 PM PDT #

hi Tor! help me please - NetBeans doesn't show cyrilic (it shows only placeholder for character as square), though I can type it, save, and see with another editors. Sorry for asking here, but cannot find in google why it so. Thanks

Posted by ruby.freeman on March 18, 2009 at 10:35 AM PDT #

plz say me sme logic to set two calss for a div

Posted by vinoth kumar subramanian on March 30, 2009 at 01:48 AM PDT #

Post a Comment:

Comments are closed for this entry.