Thursday May 31, 2007
Web Service Designer in NetBeans IDE 6.0
In NetBeans IDE 6.0, you'll find a very powerful new feature... the Web Service Designer. In 6.0 Milestone 9, this is what it looked like:

The source view shows standard JAX-WS code. (The three buttons at the top, "Reliable Messaging", "MTOM", and "Security", indicate something else that's very good news... WSIT will be a standard part of NetBeans IDE 6.0.) Pretty cool feature, initially for creating web services, but ultimately for managing them and for getting a quick visual overview of the underlying source code.
May 31 2007, 03:36:17 AM PDT Permalink
Managing NetBeans Project Templates
Although it's not hard to create NetBeans project templates, it's quite painful to have to update them, unless you know about what I'm going to tell you about in this blog entry. A project template is created by a wizard and each consists of a number of things. Firstly, most importantly, the template itself, in the form of a ZIP file. The template is normally an entire application, with its own sources and build files, and so on. But, in addition, a project template includes an HTML file with a description that will be shown in the New Project wizard. It also contains an icon. It also contains an XML layer file that registers the project template. It also contains a Bundle file. Hence, what happens when you update the application that you're distributing as a template? Do you need to work through the Project Template wizard again and provide all those various items all over again?
And the answer is "no". There's no need to go through the Project Template wizard again, each time you update the application. Why? Because of Ant. You can provide an Ant target, in the application that you want to distribute as a template, to create a new ZIP file whenever you change it. And you can use the Ant target to specify where the ZIP file should be created. Thus, you can pop that ZIP file automatically into the project template's source structure, overwriting the existing ZIP file. As a result, updating your project template is very easy. I learned this from Jesse, who provides this very useful Ant script as an illustration.
The nicest thing would be, in my opinion, if the application was rezipped whenever I build it. There don't seem to be handy hooks like -post-jar in the module development world, so I simply copied the build target from build-impl.xml, into build.xml. And then I added my own few lines after that, so that I had an overridden build target, extended with my ZIP functionality. Below, only the highlighted lines are my own, the rest is the standard build target in module projects:
<target name="build" depends="-init,branding" description="Build all modules in the suite.">
<subant target="netbeans" buildpath="${modules.sorted}" inheritrefs="false" inheritall="false"/>
<mkdir dir="${cluster}/config/Modules"/>
<createmodulexml xmldir="${cluster}/config/Modules">
<hidden dir="${netbeans.dest.dir}">
<custom classpath="${harness.dir}/tasks.jar" classname="org.netbeans.nbbuild.ModuleSelector">
<param name="excludeModules" value="${disabled.modules}"/>
<param name="excluded" value="true"/>
</custom>
</hidden>
</createmodulexml>
<property name="build.classes.dir" location="/home/geertjan/Desktop/TextFileDictionaryProjectTemplate"/>
<property name="examples" location="${build.classes.dir}/src/org/netbeans/modules/textfiledictionaryprojecttemplate/"/>
<zip basedir="../TextFileDictionaryProjectTemplate" destfile="${examples}/TextFileDictionaryProjectTemplateProject.zip">
<exclude name="**/build/"/>
<exclude name="**/dist/"/>
<exclude name="**/nbproject/private/"/>
</zip>
</target>
As a result of the above, my project template's ZIP file, which contains the application that I want to distribute as a template (or as a sample, which comes down to the same thing) is updated whenever I build my application. Hurray.
May 30 2007, 11:42:25 AM PDT Permalink
NASA World Wind on the NetBeans Platform
One of the few remaining questions in my life has been solved... I have finally managed to put the NASA World Wind globe into the NetBeans Platform:

The reason why it didn't work before was that if the 'ide7' cluster is enabled, an NPE is thrown in this case. Fabrizio Giudici, who has integrated World Wind into his blueMarine project sometime ago (click here to see it in action), was the one who provided me with the missing piece of this puzzle. I asked him to try to work out what my problem was, since he didn't have that problem in his application. He wrote today with, amongst others, these words:
Ten minutes ago I figured it out! blueMarine has all the platform clusters disable but "platform6": going by trial and error, I discovered that if "ide7" is enabled, the NPE is generated (on all platforms, Mac included)... looks like it prevents the loading of the dynamic libraries of JOGL.
Thanks Fabrizio! What this means, unfortunately, is that one cannot install a module containing World Wind into NetBeans IDE, because there 'ide7' must always be enabled. It's a very strange situation, but at least it is good to know that I can now integrate the cool World Wind functionality into a (non NetBeans IDE centric) NetBeans Platform application!
May 29 2007, 10:43:45 AM PDT Permalink
Chatting in NetBeans IDE on NetBeans IDE
I am a big fan of the NetBeans Collaboration Module and decided to see how/if it worked in today's 6.0 daily development build. First time for me with this module in 6.0. Plus, it would be my first time to use the Collaboration Module on Ubuntu, since I'm a recent convert to Linux, via Ubuntu. And, there were no problems at all. I found I could very easily minimize the amount of space taken up by the module, as can be seen below (I moved it all the way to the right of the IDE and there I expose only the part that is relevant to me):

As can be seen here, the space taken up by the Collaboration Module is very small. I ended up in a conversation with Lasse, who is in Denmark. He is studying computer science and has been using the Matisse GUI Builder a lot. I was going to take a screenshot of our conversation, but then I had to leave quite suddenly, before having made my screenshot.
From now on, I am going to always start up the IDE with the Collaboration Module enabled. Takes very little trouble and the benefits are limitless, since you have no idea who you might bump into there and what you might learn from them or they from you.
In other news. Users of the Visual Library API may recognize the module project I am working on in the above screenshot. I've been looking at the Visual Library Tutorial with David Kaspar, the API's author, and correcting it for NetBeans IDE 6.0. The work is complete and you can now, using NetBeans IDE 6.0, learn all about this interesting new NetBeans API via the Visual Library 2.0 Tutorial, which has now been rewritten (and improved in its explanations, in some areas) for 6.0. Want to see the final code sample, i.e., what you would get if you work all the way through the tutorial? Go here to download the sample from the wonderful new Plugin Portal.
May 28 2007, 01:47:22 PM PDT Permalink
Text File Dictionary Project Template
In 5.5 (and, possibly 5.5.1, but definitely not 6.0) install this module:
org-netbeans-modules-textfiledictionaryprojecttemplate.nbm
After installing the module, you will find this new sample in the New Project wizard:

When you complete the New Project wizard, you will find a module suite in the Projects window:

Right-click the above and choose Run. A new instance of the IDE starts up, installing the suite's three modules in the newly started IDE. When you open a text file, you will have code completion.
Note: By default, there will be no code completion, because you need to specify a file that contains the words which you want to be displayed in the code completion box. The file containing the words displayed in the code completion box is set in the Options window. For this purpose, the module adds a new section (called "Dictionary File") to the Miscellaneous category. FYI, included in the TextFileDictionaryTemplate sources you will find a file called "English.0", which contains a very long list of English words. You could register that in the Options window. After you click OK, the words in the registered dictionary file will appear in the code completion box.
You may need to specify proxy server settings, if you're behind a firewall, because an on-line web service is accessed, for the definitions of the words, which appear in the documentation section of the popup. However, the web service only defines English words. So, if your dictionary file contains words that are not defined by the web service, such as all non-English words, the documentation popup will not work. When everything is working, i.e., you've defined a dictionary file in the Options window and the web service is responsive, you will be able to use code completion in text files, as shown below:

To get the tooltip shown in the screenshot above, press Alt-P.
Why would you want to make use of this sample? Two reasons. First, you're learning about code completion. The TextFileDictionaryTemplate module provides a complete implementation of the Editor Code Completion API. So inspect the sources to learn from them and discover how they work. One of the tutorials on http://platform.netbeans.org (here) should be of some help in understanding the code. Second, maybe you would like to make use of the functionality when editing text files. Pretty useful, I've found. Be aware that there might be a slight delay, depending on your connection, because of the time taken to retrieve the definitions from the web service.
I have a semi-working version of this module for 6.0, but want to work on it a bit more and want to make it available once 6.0 is released. The 5.5 version, i.e., provided and described above, has one or two imperfections, but they're quite small. There's enough there to show you how code completion works under the hood.
May 27 2007, 05:51:24 AM PDT Permalink
REST in 6.0
I need to begin updating the 'Web Services' section of the NetBeans helpset soon, for the 6.0 web service enhancements, relating to the new support for RESTful Web Services. Here are some really useful and practical resources I've found thus far:
- Screencast
- NetBeans REST Support in Chris Webster's blog
- NetBeans Demo at JavaOne in Paul Sandoz's blog
- REST vs. SOAP in Milan Kuchtiak's blog
Are there other resources for RESTful Web Services in NetBeans IDE 6.0?
May 25 2007, 09:44:07 AM PDT Permalink
Application for Finding and Reciting Shakespeare
Roumen told me about Tor using FreeTTS during one of his presentations at JavaOne. It is a free open source speech synthesizer. In Java. I combined a small code snippet (thanks Roumen), with this web service (which I blogged about a lot about a year ago):
http://www.xmlme.com/WSShakespeare.asmx
And now, as a result, I need never read Shakespeare again. Why? Because my application reads it for me. Here's the simple user interface:

First, I click Fetch, then the snippet is sent to the web service and the text area is populated with a large chunk of Shakespeare, based on my search string. Then, I click Read, and the content of the text area is recited. It's pretty cool to hear the result being recited, especially when punctuated by "slash speech". Nice computereeze ending to a Shakespearean snippet...
Here's the code under the Read button:
VoiceManager voiceManager = VoiceManager.getInstance();
Voice helloVoice = voiceManager.getVoice("kevin16");
String text = jTextArea1.getText();
helloVoice.allocate();
helloVoice.speak(text);
helloVoice.deallocate();
Shakespeare must be rolling in his grave. That it should come to this, his wisdom being mangled with XML tags, robotized by a computer voice named "kevin16". Still, though, significantly better than some live performances I've seen.
May 24 2007, 10:34:29 AM PDT Permalink
About the About Dialog Box
This is the NetBeans About dialog box that we all know and love:

The question for today is: "How far can we go in deconstructing this dialog box? How far can we break it down to its bare elements and then rebuild it in our own image?"
My image is humble, hence this is the result of the quest outlined above:

Before continuing, please note that the solution is possibly really simple. Just use the XML layer file to hide the menu item that produces the About dialog box, add a new menu item by means of the Action wizard, and then let that new menu item call up a new dialog box. Then create that new dialog box yourself. That's the best and most useful way of going about customizing this dialog box. Just replace it. That's all.
However, assuming you (for some reason) want to keep the About dialog box, but change its contents for your own purposes, here are some pointers:
- Firstly, many things can be changed in the user interface of a module suite project. Create a module suite project, right-click the project node, and choose Properties. You are now in the Project Properties dialog box. In the Build panel, choose the radiobutton that says "Create Standalone Application". Now you can change the application icon, which is shown in the Details tab of the About dialog box. In the Splash Screen panel, you can change the splash screen, which is shown in the About panel of the About dialog box.
- Now you've changed the icon in the Details tab, as well as the content of the About tab in the About dialog box. However, lets go further and change the texts in the "About" and "Details" tabs. Above, you see I've changed them to "Hahaha" and "Hohoho". How to do that? Here you see the two strings you need to redefine in the Bundle.properties file shown below, which is created automatically when you click the radiobutton referred to in the previous step, which creates a standalone application:

- Next, let's think about changing the content of the "Details" tab. In the NetBeans sources, go to this location:
\core\src\org\netbeans\core\actions
There you will find a class called AboutAction. This is what its performAction method provides:
public void performAction () { Splash.showAboutDialog( org.openide.windows.WindowManager.getDefault().getMainWindow (), new org.netbeans.core.ui.ProductInformationPanel () ); }That's the key to the About dialog box. The first argument is the IDE's frame and the second provides the Details tab. So, in my own module I've created my own action, which replaces the menu item that calls up the About dialog box, and this is my performAction, with only the highlighted line below having been changed:
public void performAction() { Splash.showAboutDialog( org.openide.windows.WindowManager.getDefault().getMainWindow(), new org.yourorghere.about.NewJPanel() ); }In other words, I now have a new panel that replaces the Details tab. For this to be possible, you need to import the org.netbeans.core.startup.Splash package, which means that you must declare a dependency on the Startup module.
Note: The Splash class is not public. Use it at your own risk. (A simple way of doing so is to create a dependency on the Startup module's implementation version, instead of its specification version.)
- What if you want to keep the Details tab but change its contents? That's also possible. The Details tab is provided by a panel called ProductInformationPanel, which is found in this location:
\core\src\org\netbeans\core\ui
This is what it looks like, when opened in the IDE:

To change the contents of this panel, look at how the various User Codes above are constructed and override them via branding, as shown for the texts in the About tab and the Details tab.
- Can you add a new tab to the About dialog box? Well, as you can see earlier, the Splash.showAboutDialog() calls up the About dialog box. It takes two arguments, a Frame and a JComponent. Hence, that's the reason why I was able to replace the Details tab, because I simply put a different panel in its place. Clearly, though, no new panels can be added, because only two arguments can be accepted. For this reason, if you want more panels, you will have to create a whole new About dialog box, which probably makes more sense anyway.
Unless I am very much mistaken, I think I've addressed all the possible questions that can possibly be asked in relation to the customization of the About dialog box. I must say, all this could be a lot easier than it is, because the user interface currently doesn't provide much help in this area. Understandably, though, this area of the platform wasn't considered a very high priority when providing user interface support in the platform area, back in 5.0. Hopefully, though, a future set of enhancements in the platform development area will also cover the About dialog box.
May 23 2007, 06:01:15 AM PDT Permalink
Share Your Experiences Of The RCP Book?
Have you read or are you reading Rich Client Programming: Plugging into the NetBeans Platform? If so, why not write a review on the book's site on Amazon? Here's a link to the book's Amazon site. By adding reviews there, you're providing information that others, deciding whether they want to buy the book or not, might find useful.
In addition, the book can also be bought here:
http://sunlibrary.safaribooksonline.com/9780132354806
That's on the Safari Books Online site. While writing the book, we made excellent use of Safari's "Rough Cuts" program, which allowed us to provide an early draft in PDF format, for those who couldn't wait for the book to be published. In fact, in the Safari May 2007 Newsletter, you'll find an interview with me about experiences relating to the Safari Rough Cuts program. Some of the questions discussed are as follows:
- Your new book is titled Rich Client Programming: Plugging into the NetBeans Platform. What do you mean by the term "rich client programming"?
- What distinguishes your book from the other NetBeans books out there? What were your goals in writing it?
What were the biggest challenges in writing Rich Client Programming: Plugging into the NetBeans Platform? Was it more work than you expected?
To read the interview, click here:
http://sunlibrary.safaribooksonline.com/newsletter#interview
In other news. Have you seen Roumen's tour through the highlights of the Visual Library? (Hard to miss, it's been in the Welcome screen for a while and has been featured all over the place recently.) But, if you have missed it thus far, click here to go directly to Javalobby and see the Visual Library go through its paces!
May 22 2007, 08:43:08 AM PDT Permalink
Basic Groovy
I'd have put this on the Plugin Portal, but I don't seem to be able to access it. So here it is, very basic Groovy support:
I got an error when I switched to the Console view on Ubuntu Linux, but encountered no such error on Windows. So as far as I know, this works on Windows. Download the ZIP file above and you'll find three NBM files. Install them in 6.0 Preview (Milestone 9) and you'll be able to use the functionality illustrated in the following few screenshots.
First, you'll have two new project types:

Next, when you have a Groovy file, you'll also have a Console view (this is the part that fails for me on Ubuntu Linux 7.04):

In the Source view, you can also run Groovy files, with some broken syntax coloring to confuse you:

Note that some attempt has been made to keep the two views synchronized, the thinking being that you experiment a bit in the Console view and then you adopt whatever you like there in the Source view.
Finally, you can also put Groovy files in Java applications, as can be seen here:

In other words, this is the Coyote functionality, ported to 6.0, with a few other experimental things (e.g., broken Schliemann syntax coloring) thrown in. Use at your own risk.
May 21 2007, 04:55:26 AM PDT Permalink
GlassFish, Tomcat, and Oddly Shaped Bicycles
There's some debate in mailing lists and other places about the wisdom or otherwise of continuing to bundle Tomcat with NetBeans IDE. Some believe that it would make more sense to favor GlassFish, at least partly since it is an open-source alternative to Tomcat (although the latter is a web server, while the former is an application server), while others argue that Tomcat is pretty much the de-facto web server of choice, hence an IDE would be shooting itself in the foot (assuming an IDE had a foot) by not bundling it, especially if it had been doing so all along.
I don't know the right answer to these questions and you're not going to find my opinion on these questions in this blog entry, since I don't really have one. However, people deserving the special attention of cranial surgeons are those who begin their e-mail with: "I haven't used GlassFish for over a year, however it is slow." Those people need to be hoisted into a tight white jacket and then locked up in a ward adjoining the one containing those who start their e-mail with words such as: "Although I haven't used NetBeans IDE for the last five years, here are my thoughts."
The reason for the summary justice that should be meted out for such offences is that these statements are the equivalent of saying: "I haven't ridden a bicycle since 1871, but I hate how the front wheel is so much larger than the back wheel." For those who want to know, this is how a bicycle looked in 1871:

Seriously, how can you have an opinion on a piece of software that is constantly, daily, being improved when you haven't used it for over a year? I'm not sure what the internet equivalent of a slap in the face is, but that's what you should get if you can have any opinion on GlassFish if you haven't used it for some time. In fact, you can't have much of an opinion if you haven't used it recently. Even more in fact, you can start up a NetBeans IDE 6.0 daily build and install the GlassFish V3 Server plugin. (You probably won't find this plugin in milestones yet. It is only in the plugin center for daily builds.) Even though the plugin doesn't do anything with server resources, such as JDBC and JPA, one can already see, with the naked eye, that the start up time is significantly improved. I am no expert, but to me it seems like the start up time is already equivalent to Tomcat. Of course, since the various server resources aren't being started up, because they're not supported yet, it is impossible to say how things will be when the final release of GlassFish comes out. However, effectively, GlassFish currently is nothing more than a web server, so one can, to some extent, already compare it to Tomcat, while realizing of course that it is no where near to being stable. FYI, here's a screenshot of what you'll see after registering the technology preview of GlassFish V3, which you can do once you've installed the aforementioned plugin (I don't like the underside of the tabs, among other things, in the IDE below, on Ubuntu Linux 7.04, running on JDK 6 and above, but I've commented on this before):

Now, start up time of GlassFish may or may not be relevant to whether or not NetBeans IDE should continue to bundle Tomcat, but if a full blown application server (i.e., GlassFish) has the same performance as Tomcat, (note that I'm saying "if"), wouldn't the fact that it is performant and more powerful (i.e., no one denies that GlassFish can do far more than Tomcat, it would be silly to deny that, because it is objectively true) wouldn't that mean that GlassFish is objectively BETTER than Tomcat? I'm happy to be shown to be wrong. Just please don't start out by saying that you haven't used GlassFish for a long time. At the very least, pretend you have... :-)
May 18 2007, 11:26:09 AM PDT Permalink
DocBeans
When we wrote "Rich Client Programming: Plugging into the NetBeans Platform" (the 600 page must-read that is taking the New York bestseller list by storm), we wrote it in DocBook XML, using our own lightweight home-brewed tooling solution. I've blogged about this before and about how useful we found it. Tim (Boudreau) and Jesse (Glick) had created two NetBeans modules some time back and we simply installed them in some early build of 6.0 and hacked away at our chapters, then committed them to CVS, just like any other source file. There were some very powerful features to these modules, in particular the ability to generate HTML from an individual DocBook XML document or from the entire book, via one click of a menu item.
Now that the book is done, and the use of the DocBook modules has proven so effective, a few people within Sun are considering using them within other contexts. In these contexts, one can't really talk about "the DocBook modules" anymore, since that term is only meaningful to NetBeans developers. It makes more sense to talk about the whole product, which is a scaled-down version of NetBeans IDE plus the two DocBook modules, as a product in itself. In that sense, the fact that it provides support for local history is just as relevant as its DocBook-HTML generation facility, because the end user sees the product as one whole, not as a collection of modules. Currently, this is how the end product, tentatively called "DocBeans", looks:

There's also the possibility of us open sourcing this product, possibly on java.net, so that the community at large can benefit from it and so that the product can be supported via that route. Because, after all, that's the main downside to choosing an internal solution over an external vendor... you need to provide support (e.g., bug fixes and feature enhancement requests) yourself! But, aside from this concern, DocBeans seems like an interesting avenue to explore.
In other news. Thanks for all the tips and tricks for setting up TwinView on Ubuntu 7.04! I can't announce the winner yet, because I first need to try the solutions, which means hooking my laptop up to a secondary display, which requires such a display, which means booking a room where all that equipment is found. So it may take some time, but in due course the rightful winner will be proclaimed and rewarded with the promised postcard!
May 17 2007, 10:59:52 AM PDT Permalink
Father of Java, Father of Dork
A cool pic from NetBeans Day 2007, San Francisco, the day prior to JavaOne. Left to right on the stage: Bob Beasley, father of the Dog Oral Reward Kit (D.O.R.K.) and James Gosling, father of Java:

Below them, me. What am I doing? (In fact, what are we all doing there? What are we looking at? This could be a surreal caption competition. Or perhaps a "Spot the Ball" competition. Don't worry though, a competition comes up later in this blog entry.) I am demonstrating my hurriedly thrown together NetBeans Movie Player, created in Prague airport, in Amsterdam airport, in mid air while flying from Amsterdam to San Francisco, and (with a certain degree of desperation at that point) in my San Franciscan hotel room on the night (and early hours) before NetBeans Day. (Reasons for all this desperation are recorded in earlier entries in this blog.)
And why am I standing some way below them? In other words, why am I not on the stage with them during my demo? Because I hadn't figured out how to display my screen on the wall at the same time as on my laptop's screen, running Ubuntu 7.04 "Feisty Fawn". Whatever that's called in the technical world. Dual monitors. Dual display. Something like that. So I had to stand below the stage, giving me a better view of the wall, because I couldn't see anything on my laptop's screen, which was black. (Which, when you think about it, was a lot better than the other way round, which would have had me seeing my laptop's screen, but no one in the audience being able to see my screen on the wall. So I felt quite fortunate when I thought about that alternative scenario!) But, despite the fact that everyone could see my screen, it wasn't much fun trying to move my mouse on the wall, believe me. Expanding project nodes, and so on, imagine doing that with your mouse while everything is on the wall, and nothing is on your screen and, in addition to that, there are 1000 people with high expectations, packed in a claustrophobic room, literally inches away from you. However, what's worse, on top of that, is the fact that I still haven't figured the dual display thingy out. Someone came to me after NetBeans Day and we exchanged contact details and then he sent me instructions for how to set it it up. He told me to add the two lines in bold below to my etc/x11/Xorg.conf file:
Section "Device"
Identifier "nVidia Corporation NV43 [GeForce Go 6200/6400]"
Driver "nvidia"
Busid "PCI:1:0:0"
Option "MonitorLayout" "CRT,LFP"
Option "Clone" "true"
EndSection
I tried that, but it didn't work. (I sent the same instructions to my colleague Petr Pisl, who had had the same problem with Ubuntu 7.04. He followed the instructions and they worked great for him. But he uses Intel while I use nVidia. That must be the difference, because the guy who sent me the instructions was also using Intel.)
I ended up doing 4 presentations during the past week, at NetBeans Day and JavaOne, in contortionist positions, such that I could see the wall while simultaneously somehow being able to see my audience at the same time. In fact, I could have used Windows without a problem, since I have a dual boot set up, but (as I proclaimed, quite proudly, in explanation, at least once or twice) I'd rather use Ubuntu 7.04 uncomfortably than Windows comfortably. (That's not necessarily a negative statement about Windows, but it is a positive statement about Ubuntu 7.04 because, aside from this issue, I've been extremely happy with it.)
So, yes, this blog entry is partly an appeal to nVidia users out there on Ubuntu 7.04: "What do I need to do to set up dual display correctly?" The first person writing (to geertjan DOT wielenga AT sun DOT com) with the correct answer to this vexing question (which, right now, means more to me than "What is the meaning of life?"), will receive a beautiful postcard from Prague, signed by me (and many of my colleagues, not because they need the answer, but because I have a stack of postcards that they signed a few years ago, so that I could use them as rewards for prize winners of pseudo-competitions in this blog, such as this one). In the subject line of your e-mail, please put: "You will never need to use your mouse on the wall again!"
But, back to the picture with which I started this blog entry. Demonstrating a self-made Java application, no matter how trivial, in the presence of James Gosling himself, is surely one of the greatest honors that can befall a Java programmer. That picture is going to remain representative of a significant milestone in my life forever.
May 16 2007, 10:02:09 AM PDT Permalink
JavaScripting NetBeans
In one of the blog entries I wrote during JavaOne, I mentioned that I'd bumped into NetBeans architect Pavel Buzek, who was playing around with JavaScript and the NetBeans APIs. Since JDK 6, it is possible to run JavaScript in the NetBeans IDE's editor. Just right-click in the editor when a JavaScript file is open, if you're running on JDK 6 or above, and you'll see a "Run" menu item. Now, with the stuff that Pavel Buzek showed me, however, you're also able to run the NetBeans API classes from a JavaScript file.
Here's an example, for opening a file in the IDE (or any application on the NetBeans Platform):

How might this be useful? Quick prototyping, for example. No longer a need to create a NetBeans module project, no need to compile it, no need to install it. Probably there will be many scenarios that haven't been thought of yet, where this functionality will be useful.
Read more about it here, in Pavel's own words with several other examples, on the NetBeans Wiki:
http://wiki.netbeans.org/wiki/view/ScriptingNetBeans
In other news. Did you miss my mini-talk at the java.net booth during JavaOne? (Only about 15 people in the world can honestly say "No" to that question.) Fear not! Here's a podcast on java.net, that features my mini-talk. Also a cool pic of me in action, all on today.java.net.
May 15 2007, 11:21:09 AM PDT Permalink
More on NASA World Wind and NetBeans IDE
In the screenshot below, notice that there's a status bar. The status bar shows the latitude, longitude and elevation of whatever is under the cursor on the globe. Also, what is very useful is that you get a red blinking "Downloading" text, whenever images are being downloaded to fill out the current view. Have a look at the status bar below, so you know what I'm talking about, before I reveal the most interesting part about it:

(By the way, notice how the image above is tilted! A simple function key combination allows that to happen. That's a really cool part of the NASA World Wind story, giving me a view from Prague to Stockholm, horizontally.) OK, now here is the interesting part: you can simply grab the status bar from the samples that accompany the NASA World Wind Java SDK. Two samples are provided, each making use of a class called StatusBar.java. Pop that class into your application and then append it to whatever panel you want to append it to. Even at this point you can copy and paste code from the samples. The stuff in bold below comes straight from the samples:
public NewJFrame() {
initComponents();
StatusBar statusBar = new StatusBar();
statusBar.setEventSource(worldWindowGLCanvas1);
subPanel.add(statusBar, BorderLayout.PAGE_END);
WWHelper.setup(jList1, worldWindowGLCanvas1);
}
Notice that the status bar is added to a panel that makes use of BorderLayout. Meanwhile, I'd prefer to use GroupLayout for the design of the main panel. Here's where the point of this blog comes together. I added a small panel below my main panel, as you can see here:

As a result, I am able to add the status bar to this panel, which uses BorderLayout, while I am still able to use GroupLayout on the main panel. Hurray.
May 14 2007, 05:20:55 AM PDT Permalink


