MorkaLork Development

Interesting stuff I've picked up over the years...

Starting with J2ME

2009-06-15 19:08:21 | 424 views | MIDlet create j2me starting startapp() pauseapp() destroyapp() implement netbeans

Get an IDE

Right, these tutorials are all written using the NetBeans IDE (Integrated Development Enviroment) which can be fetched here.

There are two bundles that contains the J2ME platform, the Java bundle and the All bundle. It doesn't really matter which one of those you choose, I've chosen the All bundle which is the one that will be used in the screenshots in this article.

Download and install you NetBeans bundle and start it up:

Starting up NetBeans

To start a new project you click on the New Project button, select Java ME in categories and Mobile Application in the File Types list:

Creating a new MIDlet

You've now created an applet with the MIDP profile extending the MIDlet class.
Now press next and enter a project name. Make sure to unselected the box with the label saying "Create Hello MIDlet" (we won't need it right now):

A new MIDlet to work with!

You can now press finish. To create a MIDlet you choose New File (Just next to the New Project button) and select MIDP in the categories list and MIDlet in File Types list.

Creating a new file step 1

Press next and enter a MIDlet name and a package name:

Creating a new file step 2

After these steps you should now have an application up and running and it should look something like this:

Ready to develop

The methods startApp(), pauseApp() and destroyApp() are implemented automagically since these are abstract methods that must be implemented when inheriting the MIDlet class.

If you run the project now (F6 in NetBeans) you will see a mobile phone running your program. Since nothing is implemented yet, well, you can press the launch button as much as you want, nothing will happen:

Running your MIDlet

What you know now is how to create a MIDlet, more about what to do with it in the following articles.

Article comments

Feel free to comment this article using a facebook profile.

I'm using facebook accounts for identification since even akismet couldn't handle all the spam I receive every day.