First impressions of J2ME development with Netbeans and the Mobility Pack

With my recent interest in J2ME development, I found the time to download Netbeans and the J2ME Mobility pack. I have to say I’m quite impressed.

I’ve downloaded both version 4.1 and the 5.0 Release Candidate (RC2). One of the first things that impressed me is they both perform quite well on my (slightly …mature) laptop. Once things start up, its all quite snappy. I can find Eclipse a bit laggy at times. Of course I haven’t really put these tools through their paces yet with any advanced projects – this is really just a summary of my first inspection.

The big drawcard though (for me) is the Flow Design screen. Here’s a sample screenshot:

NetBeans J2ME Flow Design

Basically, this tool helps you set up the skeleton of your applications. You drag all the different screens onto your workspace, and connect them to illustrate program flow. For example, the default project comes with a “Hello World” program that has an exit option. The screenshot above shows me inserting an “Are you sure?” screen when a user chooses “exit”. So, the exit option now connects to the new screen which presents them with OK and Cancel options. Cancel directs you back to last screen and OK takes you to the “Exit” state. Took me 20 seconds.

This is a great idea for mobile development – compared to a Swing application, a mobile app is likely to have large number of different screens/forms that all interconnect due to the limited screen real estate. This feature really takes the drudge out of that.

You also have a Screen Designer for placing widgets (“Items”) on your screen. Also great, although not as ground breaking as you may think – J2ME’s layout capabilities are pretty simple, so there’s less advanced formatting required (or even possible!). Very handy nontheless.

Once you have your rough architecture sketched out, adding your code is pretty straightforward – the generated code is reasonably clean and well thought out. Versions 4.1 and 5.0 differ slightly in their approach as to how you integrate your custom code:

  • In version 4.1, the generated code is “locked” and uneditable. One of the forms allows you to insert some code in the generated sections (with which you might do a “callMyMethod()”). You can then go to the code view and fill out the implementation. This feels a bit limited, especially as the form doesn’t seem to be able to do intelligent auto-complete.
  • In version 5.0, the generated code is “kind of locked” ;) . You can’t change it, but you can add to it. So, you generate your code structure, open it up in the source view and add whatever behaviour you want.

(At least thats the way it appears after a 15 minute look, without reading any of the help doco!)

I think it all looks pretty cool. The biggest thing holding me back is that I’m an eclipse guy, so I’ve got a bit of a hurdle getting used to the new user interface, keyboard shortcuts, etc. But its compelling enough that I’m going to have go at using NetBeans as my J2ME development tool, while still keeping Eclipse as my normal Java IDE. I’ll keep you posted as to how I go…

5 Responses to “First impressions of J2ME development with Netbeans and the Mobility Pack”

  1. Roman Strobl says:

    Good luck with mobility pack and we’d be gratful if you would share your experiences with transition from Eclipse to NetBeans. We want to make it as simple as possible.

  2. x says:

    How does it compare to EclipseME? Does the optimizer work in Java ME mode?

    Also, I’m a bit doubtful of generated code for Java ME applications. You need to keep absolute control over your code in Java ME, every byte matters, and you won’t go very far with generated code.

  3. Lukas says:

    Well, there are other feature than just Visual Designer. Try device fragmentation solution – our preprocessor. Try generete client to webservice or servlet.
    (http://blogs.sun.com/roller/page/lukas?catname=%2FTIP)

  4. dasman says:

    Thanks Lukas – the link you provided to your page is great – well worth a read, for anyone else browsing this entry.

    I still think the Visual Editor is the big “gee-whiz” drawcard ;) , but your point that there are other goodies “under the hood” is well-taken!

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-spam image