Creating CDC applications

For a CDC application we will create a project that shows the main differences between MIDP and CDC in the NetBeans context.

It is worth noting that NetBeans does in fact provide all of the components for building both configurations in a seamless manner and even changing configurations by accessing the properties of each project.

Getting ready

If NetBeans is not currently installed visit the download sections on:

http://download.netbeans.org

It is possible to find the full version of NetBeans, named as Java and that contains Java ME; upon installation remember to select the Java ME option.

With NetBeans ready, we can start coding.

How to do it...

  1. Create a new project, this can be achieved either by clicking File and then New Project or by pressing Ctrl+Shift+N.
  2. On the New Project window on the Categories side choose Java ME and on the Projects side select CDC Application, then click Next.
  3. Under Name and Location: Name the project as MyCDCApp, leave the other options with their default values and click Next.
    How to do it...
  4. Under Select Platform: On Emulator Platform select Java(TM) Platform Micro Edition SDK 3.0.
  5. Click Finish.

How it works...

NetBeans builds the file structure around the CDC platform. As it is common with many of the projects created by NetBeans, this project, too, is built and maintained by an Ant build file.

The project structure is rather similar to the one created for a CLDC application. One difference lies on the fact that with a CDC application we do not have the use of Java Application Descriptor (JAD) files, as evidenced when the project is built.

A JAD file is a compressed JAR file that package MIDlets. It is the JME installation file.

After being built, the file structure is as follows:

How it works...

There's more...

After developing the application let's see how it goes by running the project.

Running the project

To see how the CDC project looks like in the emulator, simply right-click on our project and select Run.

The following screenshot shows the emulator running our project:

Running the project
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.195.162