|
Installation of the Gidlet library with NetBeans IDE:
- Download the latest version of Java SE from java.sun.com. Look at the homepage for ->Popular downloads -> Java SE.
- Install the JDK in any folder (below called <jdkroot>).
- Add the <jdkroot>/bin directory to the application path environment variable. (You should be able to call java, javac, jar from within a command shell.)
- Download the the latest version of NetBeans (version 6.5 or higher) from www.netbeans.org/products. Select a bundle that contains Java ME.
- Install NetBeans by following the installation guidelines.
- Download the latest version of the Gidlet distribution from www.aplu.ch/gidlet and unpack the zip archive in any folder.
- Copy gidlet.jar in any folder, e.g. c:\jars.
- Check your installation by creating a first gidlet. Select File | New Project and choose Jave ME in the Categories pane and Mobile Application in the Projects pane. Press Next. Enter a project name, e.g. TestGidlet. Uncheck Set as Main Project and Create Hello MIDlet. Press Finish. The new project is added in the Projects pane.
- In the Projects pane right-click on TestGidlet and select
New | MIDlet.
- Choose the MIDlet Name and the MIDP Class Name, e.g. MyGidlet and press Finish. The template code opens in the editor window.
- Modify the code, e.g. as follows
// MyGidlet.java
import ch.aplu.gidlet.*;
public class MyGidlet extends Gidlet
{
public void main()
{
MPanel p = new MPanel();
p.move(0.5, 0.5);
p.fillCircle(0.4);
}
}
- In the Projects pane right-click on TestGidlet and select Properties. Many J2ME specific options are displayed.
Choose Libraries & Resources, then press Add Jar/Zip and select gidlet.jar in the folder where you put it in (e.g. c:\jars). Press OK.
- Select Application Descriptor in the Category pane and select the MIDlets tab. Click Edit and make sure that the MIDlet Name and the MIDlet Class is MyGidlet.
- Press OK to close the properties window.
- Right-click on the project name and select Run. The project is compiled, preverified and built and the Default Color Phone should appear. Click the button below the Launch label. A black circle should be drawn.
- Consult the Java documentation of class www.aplu.gidlet.MPanel and play around with some other simple examples.
- You may adapt the MIDlet template to your needs by selecting Tools | Templates | MIDP | MIDlet and clicking on Open in Editor. Change the text, e.g.as follows
// ${name}.java
<#if package?? && package != "">
package ${package};
</#if>
import ch.aplu.gidlet.*;
public class ${name} extends Gidlet
{
public void main()
{
}
}
If you do not need all classes in gidlet.jar, just extract them in order
to keep your MIDlet jar as small as possible. To further optimize it,
use the optimizer/obfuscator by selecting the Obfuscation Level in the Properties window (under Build | Obfuscating).
The distribution .jar/.jad can be found in the subdirectory dist of the current project directory.
The Gidlet distribution contains many typical examples. Study and execute them in order to gain a deeper insight in the Gidlet framework.
In any case, if you have a problem or merely a question, send an e-mail to
or post a FAQ at www.aplu.ch/faq.
|
|