Learning Java with J2ME
Gidlet is the name of a class library based on J2ME (also called Java ME) to develop Java applications that run on handheld wireless devices like mobile phones. It is specially designed for introductory courses in Java programming where it is important to accentuate the principles of the programming language. The library follows the well-known educational pattern to start programming with graphics applications, which gives lot of motivation and fun. Gidlet means Graphics Information Device and the Gidlet class is derivated from the MIDlet (Mobile Information Device) class with some very useful extensions. We say that an application that uses the Gidlet library "is a gidlet".
A gidlet is developed like any other Java program on a computer within your favorite IDE. The source program is edited and compiled using the ordinary J2SE compiler. Because the Java Virtual Machine running on the mobile phone is restricted due to the limited processor resources, the display and the input devices of mobile phones, the Java API distributed with J2ME is much smaller, but the language features remains almost the same. This can be an advantage for beginners who are often overwhelmed by the huge API of J2SE.
The compiled application can be tested without any real mobile phone using a virtual mobile device, called an emulator. Once the program runs on the emulator to your satisfaction it can be downloaded to the real device via a USB or Bluetooth link or deployed on a Web server and made available to the public.
The following code shows an example of a very simple gidlet drawing a Moiré pattern. It could be written without many forward references in the very first lessons on programming. Compare this code with the usual FirstMIDlet applications and you see how simple it is.
The Gidlet Framework
The Gidlet class library is based on two other similar frameworks for C++, called Champ, and the ch.aplu.util/ch.aplu.turtle package under J2SE. The purpose is to provide a tool to develop Java programs in the educational environment, where the learning curve should be kept gentle. Teaching experience in many programming courses in the past twenty years shows that graphics oriented applications, game development and Internet-aware applications give a motivation thrill to tackle the burden of a modern programming language.
Important Features (of Version 1.x):
The user application class extends the Gidlet class which is derived from javax.microedition.midlet.MIDlet and implements the entry point method void main(), that is called in a separate thread when the gidlet is started. A standard Exit soft button is displayed automatically. Clicking the Exit button will terminate the application. This makes the skeleton of a Gidlet extremely simple: