akuvidz 0 Newbie Poster

how do i call a screen from the selected list?

package PSM;

import javax.microedition.lcdui.*;

public class adminPage extends List implements CommandListener {

    private Display display;
    private Command exit;
    private String[] menu = {"Add Leave Type","Employee Leave Request",
            "Assign Leave","Show Leave Summary","Change Password"};
    private Screen[] screen;

    public adminPage(Login midlet,Display display){

        super("Admin Page",List.IMPLICIT);

        for(int i = 0;i<menu.length;i++)
        {
                this.append(menu[i],null);
        }   

        screen = new Screen[menu.length];
        /*screen[0] = addLeaveType();
        screen[1] = empLeaveReq();
        screen[2] = assignLeave();
        screen[3] = shwLeaveSmmry();
        screen[4] = changePassword();*/


        exit = new Command("Log out",Command.EXIT,3);
        addCommand(exit);


        setCommandListener(this);

    }





    public void commandAction(Command c, Displayable d) {
        // TODO Auto-generated method stub
        if(d == this){

            int index = this.getSelectedIndex();
            display.setCurrent(screen[index]);

        }

    }

}

this is my code... some how it didnt show the selected list

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.