Tuesday, April 29, 2008

A Morning with NetBeans 6.1....

I've been off working on the iPhone SDK, so I wasn't too interrupted when NetBeans 6.1 made an early entrance this week. That was until Nomine said to me "What I'd like is an application which looks up the people you are following on Twitter and the people following you on Twitter and shows who the mutual followed/following are"...

So, I broke out NetBeans 6.1 and gave it a go. First up was the Twitter access. That turned out to be very easy; NB6.1 has precanned code generators for lots of well known web services out there. So I selected Twitter and the appropriate function in the tree and drag it into my code. And pow!, there it is, complete with separate classes generated to handle the result and authentication, including popping up a user name/password authentication dialogue.

Parsing the XML was more interesting. I decided to use the XML Schema design tool in NetBeans 6.1, which I hadn't used before, but after about an hour or so of fiddling, I had a schema file which was automatically generating code for JAXB.

Next up, feeding the result of the Twitter API to create objects... Already in there. The result of the Twitter API call can be parsed into a JAXB object by calling a method on the result and telling it what JAXB class you want it turned into.

The GUI, Matisse as usual, but it's just getting better. Now there's Java Application Framework support in there I made a JAF application, and getting a button to call up Twitter and do all that parsing was a matter of picking the button and doing "Set Action" on it. NetBeans 6.1 can also code generate all the background processing bits, including an animated busy indicator.

And that was an application built. Doesn't actually change anything but boy, it shows how useful NetBeans 6.1 is.

No comments: