The IconCommand
class extends the LCDUI Command
class by allowing MIDlets to provide an icon to a Command. This is
a new feature in Java runtime 2.0.0.
IconCommand
can be mapped to action button
1 and CategoryBar
.
IconCommand
can be created using the system
icon ID or by using MIDlet defined images.
A single icon can be displayed as action button 1 using the IconCommand
class. If more than one IconCommand
is added to the display, only one IconCommand
(the
command with the highest priority) is displayed as action button 1,
whereas the rest are mapped to action button 2 and are placed as text
labels under options menu. You can use either a system defined icon
(by using an icon ID defined in this class) or your own icon for an IconCommand
.
Whereas in earlier Series 40 platforms, you could just relabel the softkey, now you need to either use a limited set of provided icons, or create the graphics for the command.
For more information about using Command
s and IconCommand
s, see sections Command and IconCommand.
In full touch, default systems icons are
available. For a complete list of default system icons, see IconCommand
Constructor Details
IconCommand(String label, int commandType, int priority, int iconID)
Usage
/*Creates a IconCommand with the command type OK which is mapped to action button 1 with the system icon image (image for IconCommand.ICON_OK). */ IconCommand okCommand = new IconCommand(“OK”, Command.OK , 1 , IconCommand.ICON_OK );
If no proper commands are assigned, action button 1 will not be visible.
Constructor Detail
public IconCommand( String label, Image unselectedIcon, Image selectedIcon, Int commandType, Int priority)
Usage
// Images provided to present the selected and unselected icons Image img = Image.createImage(“/selected.png”); Image unselImg = Image.createImage(“/unselected.png”); // Create the IconCommand using defined images IconCommand imgCommand = new IconCommand(“OK”, unselImg, Img, IconCommand.ICON_OK , 1);