How to add an ActionListener to a List ? please help me by code

9 views
Skip to first unread message

Sondes Hammami

unread,
Apr 20, 2017, 5:29:56 AM4/20/17
to CodenameOne Discussions
If you are experiencing an issue please mention the full platform your issue applies to:
IDE: NetBeans/Eclipse/IDEA
Desktop OS
Simulator
Device

steve nganga

unread,
Apr 20, 2017, 6:48:13 AM4/20/17
to codenameone...@googlegroups.com
You can try something like below.  use your code on the the commented space. Also note am using lambda expression feel free not to use it if you are using java 7 and below.

 Form v[]={form1,form2,form3,form4};

        l.addActionListener((e) -> {
            
            // Your code here
            eg
             v[l.getSelectedIndex()].show();
            
        });
        

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsub...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/b7780132-0fc0-4e94-8c94-c5bc9be9eca8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages