Java DTV API 1.3
18-Nov-2009

com.sun.dtv.lwuit
Class Command

java.lang.Object
  extended by com.sun.dtv.lwuit.Command
All Implemented Interfaces:
ActionListener

public class Command
extends Object
implements ActionListener

The action placed on the soft buttons and in the Menu on devices, similar to the MIDP command abstraction and Swing's Actions. Unlike the MIDP abstraction this class can be derived to implement the right behavior


Constructor Summary
Command(String command)
          Creates a new instance of Command.
Command(String command, Image icon)
          Creates a new instance of Command.
Command(String command, Image icon, int id)
          Creates a new instance of Command.
Command(String command, int id)
          Creates a new instance of Command.
 
Method Summary
 void actionPerformed(ActionEvent evt)
          This method is called when the soft button/Menu item is clicked.
 boolean equals(Object obj)
          Compare two commands.
 String getCommandName()
          Gets the Command Name.
 Image getIcon()
          Returns the icon representing the command.
 int getId()
          Return the command ID.
 int hashCode()
           
 String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Command

public Command(String command)
Creates a new instance of Command.

Parameters:
command - the string that will be placed on the Soft buttons\Menu

Command

public Command(String command,
               Image icon)
Creates a new instance of Command.

Parameters:
command - the string that will be placed on the Soft buttons\Menu
icon - the icon representing the command

Command

public Command(String command,
               int id)
Creates a new instance of Command.

Parameters:
command - the string that will be placed on the Soft buttons\Menu
id - user defined ID for a command simplifying switch statement code working with a command

Command

public Command(String command,
               Image icon,
               int id)
Creates a new instance of Command.

Parameters:
command - the string that will be placed on the Soft buttons\Menu
icon - the icon representing the command
id - user defined ID for a command simplifying switch statement code working with a command
Method Detail

getId

public int getId()
Return the command ID.

Returns:
the command ID

getCommandName

public String getCommandName()
Gets the Command Name.

Returns:
the Command name

getIcon

public Image getIcon()
Returns the icon representing the command.

Returns:
an icon representing the command

toString

public String toString()
Returns a string representation of the object.

Overrides:
toString in class Object
Returns:
Returns a string representation of the object

equals

public boolean equals(Object obj)
Compare two commands.

Overrides:
equals in class Object
Parameters:
obj - a Command Object to compare
Returns:
true if the obj has the same command name

hashCode

public int hashCode()
Overrides:
hashCode in class Object

actionPerformed

public void actionPerformed(ActionEvent evt)
This method is called when the soft button/Menu item is clicked.

Specified by:
actionPerformed in interface ActionListener
Parameters:
evt - the Event Object

Java DTV API 1.3
18-Nov-2009

Copyright © 2008-2009 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved.

U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements. Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.Products covered by and information contained in this service manual are controlled by U.S. Export Control laws and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited. Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.

DOCUMENTATION IS PROVIDED AS IS AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.

Use of this document is subject to license terms.