Command

Commands are an essential part of almost any eSWT application. On Symbian platform, they are displayed much like LCDUI Commands.

Figure: A list of Commands with a CommandGroup selected

To create and add a Command to the parent, do the following:

Command myCommand = new Command(parent, Command.EXIT, 0);

This creates a Command attached to a parent, with the type and priority set as in LCDUI Commands. Unlike the LCDUI Command, it is not possible to enter labels directly in the eSWT Command constructor. You must use setText(String) and setLongLabel(String) methods instead.

To catch Command selections use addSelectionListener(SelectionListener) method. There is no limit to how many SelectionListeners you assign to a single Command. They are all notified when the user selects a Command.

Images can not be set on Commands.

For more information and a practical example, see the Command demo in the eSWT Showcase.

Note: The appearance of eSWT Commands is dependent on the implementation of eSWT on the used platform so the look might be slightly different on different systems.