Sunday 4 November 2012

LWUIT Tabs Creation in j2me

You can check the Complete Code to Create LWUITTabs here

To Successfully Execute this Application you need to  Download the LWUIT jar File from Here

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import com.sun.lwuit.Display;
import com.sun.lwuit.Form;
import com.sun.lwuit.List;
import com.sun.lwuit.Tabs;
import com.sun.lwuit.layouts.BorderLayout;
import javax.microedition.midlet.MIDlet;

/**
 * @author pavan
 */
public class TabsMidlet extends MIDlet {

    private Tabs tabs;
    private List tab1List;
    private List tab2List;
    private List tab3List;
    private List tab4List;
    private Form form;
    private String[] items1 = {"Item1", "Item2", "Item3"};
    private String[] items2 = {"Item4", "Item5", "Item6"};
    private String[] items3 = {"Item7", "Item8", "Item9"};
    private String[] items4 = {"Item1", "Item2", "Item3"};

    public TabsMidlet() {
       
        Display.init(this);

        form=new Form();
        tab1List = new List(items1);
        tab2List = new List(items2);
        tab3List = new List(items3);
        tab4List = new List(items4);
        tabs = new Tabs();
        tabs.addTab("Tab1", tab1List);
        tabs.addTab("Tab2", tab2List);
        tabs.addTab("Tab3", tab3List);
        tabs.addTab("Tab4", tab4List);
        tabs.setChangeTabOnFocus(true);
        form.setLayout(new BorderLayout());
        form.setScrollable(false);
        form.addComponent(BorderLayout.CENTER, tabs);
        }

    public void startApp() {
                form.show();
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }
}

No comments:

Post a Comment