Starting with J2ME
Written by:
maffelu
, 2009-06-15 19:08:21
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:
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:
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):
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.
Press next and enter a MIDlet name and a package name:
After these steps you should now have an application up and running and it should look something like this:
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:
What you know now is how to create a MIDlet, more about what to do with it in the following articles.