Search code examples
javajava-melwuit

Remove Index in lwuit list


I have created List using LWUIT.
but is shows me item with index.
like

  1. item-1
  2. item-2
  3. item-3

I want to remove left side index 1,2,3 how can I do that?

Code:

 class mainForm extends Form implements ActionListener{

        List list;

        String newkey = "";
        final String COMPANY[] = {"AIRCEL", "AIRTEL", "BPL", "BSNL", "IDEA", "RELIANCE", "TATA DOCOMO", "TATA INDICOM", "UNINOR", "VIRGIN", "VIDEOCON", "VODAFONE", "AIRCEL1", "AIRTEL2", "BPL1", "BSNL1", "IDEA1", "RELIANCE1", "TATA DOCOMO1", "TATA INDICOM1", "UNINOR1", "VIRGIN1", "VIDEOCON1"};
        final int CO_LENGTH = COMPANY.length;

        mainForm() {

            super("Main Form");
            setLayout(new BoxLayout(BoxLayout.Y_AXIS));

            list = new List(COMPANY);
           list.addActionListener(this);


            list.setPreferredW(getWidth());

            addComponent(list);



        }
}

Thank you.


Solution

  • Try:

    list.setListCellRenderer(new DefaultListCellRenderer(false));
    

    The javadocs explains the reason for false "showLineNumbers"