< Index | Tutorial 1 : My First Kuix App

Tutorial 1 : My First Kuix App

Tutorial overview

This tutorial is a little bit more consistent than a classic Helloworld tutorial, it is rather a quick Kuix overview.

The first part is a quite a classic Helloworld midlet but with several improvements. In a second part, we illustrate the power of Kuix through an advanced UI design that shows how to create easily your first graphical application with the first logical blocks and built-in user actions management. In a third part we extend the user action management through a full event management with featured widgets as buttons and popup boxes. Then we will perform a brief tour with the i18n features included with Kuix before ending with a dynamic data display and binding between graphical widgets and Java ME variables.

Basic midlet

For this first part of the HelloWorld tutorial, we will see how to create a Kuix Midlet and start displaying static data. Screenshots are provided for NetBean 6.5 IDE but it can be followed under Eclipse with few adaptations.

If you need more information about configuring your IDE, please refer to the Tutorial 0 : Getting Started.

Download source code Download this tutorial step.

  1. Create a new project. File > New Project...

    Create a Mobile Project

  2. Select Java ME > Mobile Application and click next.

    Select Mobile application

  3. Set the project's name and uncheck Create Hello MIDlet and click next

    Set the project's name

  4. Select the default platform and click finish

    Select the default platform

  5. Right click on your fresh created project and select Properties. In the dialog window, select Libraries & Resources and click on Add Jar/Zip. Navigate to the files (kuix.jar and kutil.jar) you have downloaded.

    Here we assume that you have previously downloaded, kuix.jar and kutil.jar.

    Link the project to Kuix and Kutil library

  6. Once the project created, create a new class object

    This object will be your midlet. Specify a class name, optionally a package and set its superclass to KuixMidlet. If you cannot browse for this class, you project may not be correctly linked to Kuix (step 5).

    Create the midlet

    The new class extends KuixMidlet

  7. You need to define the Midlets that make up the Midlet Suite. In other words, you should register your HelloWorld midlet with your Midlet Suite.

    Right click on your project an open the properties dialog. Select the Application descriptor section and move to the Midlets tab:

    Add midlet

  8. Now we create a first widget that will contain our text.

    Implement the initDesktopContent method of your midlet with the following code :

    public void initDesktopContent(Desktop desktop) {
        // create a displayable Screen object
        Screen screen = new Screen();
        // create a Text widget to show some basic text
        Text text = new Text();
        // set the Text of your object to "Hello World!"
        text.setText("Hello World!");
        // add the text to the screen
        screen.add(text);
    
        // set the application current screen  
        screen.setCurrent();
    }
    
  9. At this point, we would be able to start our midlet.

    Click on the Run main project button or hit F6.

    You should see something like the following screen.

    Run the midlet


Go forward, let's take a look at Tutorial 2.