O'Reilly logo

Java™ ME Game Programming, Second Edition by Ph.D. Martin J. Wells, Ph.D. John P. Flynt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Lists with Single Selection

When you create an instance of a list, you usually associate Command objects with it. The Command object then allows you to process messages issued by the list. To process messages for specific items, you can make use of the getSelectedIndex() and getString() methods of the List class. The ListTest class provides you with an example of how to process messages issued for lists defined using the EXCLUSIVE and IMPLICIT modes. You can alter the line preceding comment #1 to view the effects of the different modes. The ListTest class is in the Chapter 9 folder and is included in the Chaper9MIDlets project for NetBeans. Here is the code for the class. Discussion of the class appears in the sections that follow.

/* * Chapter ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required