# Class NavigationCommand

java.lang.Object
com.codename1.ui.Command
com.codename1.ui.NavigationCommand

All Implemented Interfaces:
  `ActionListener<ActionEvent>`

public class NavigationCommand extends Command
The NavigationCommand is a Command that navigates to a given Form. The NavigationCommand calls the show() on the Form object that is returned from getNextForm().

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NavigationCommand(String command)`
  Creates a new instance of NavigationCommand
  `NavigationCommand(String command, int id)`
  Creates a new instance of NavigationCommand
  `NavigationCommand(String command, Image icon)`
  Creates a new instance of NavigationCommand
  `NavigationCommand(String command, Image icon, int id)`
  Creates a new instance of NavigationCommand

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `actionPerformed(ActionEvent evt)`
  This method is called when the soft button/Menu item is clicked
  `boolean`
  `equals(Object o)`
  compare two commands
  `Form`
  `getNextForm()`
  Gets the next Form
  `int`
  `hashCode()`
  Allows storing commands in a vector/hashtable
  `void`
  `setNextForm(Form nextForm)`
  Sets the Form to navigate to when the actionPerformed is invoked on this Command

  ### Methods inherited from class Command

  `create, createMaterial, getClientProperty, getCommandName, getDisabledIcon, getIcon, getIconFont, getIconGapMM, getId, getMaterialIcon, getMaterialIconSize, getPressedIcon, getRolloverIcon, isDisposesDialog, isEnabled, putClientProperty, setCommandName, setDisabledIcon, setDisposesDialog, setEnabled, setIcon, setIconFont, setIconGapMM, setMaterialIcon, setMaterialIconSize, setPressedIcon, setRolloverIcon, toString`
  Modifier and Type
  Method
  Description
  `static Command`
  `create(String name, Image icon, ActionListener ev)`
  Creates a new command instance that encapsulates the action listener and details, the main value of this approach is in our ability to write commands using the shorthand lambda syntax of Java 8.
  `static Command`
  `createMaterial(String name, char icon, ActionListener ev)`
  Creates a new command instance that encapsulates the action listener and details, the main value of this approach is in our ability to write commands using the shorthand lambda syntax of Java 8.
  `Object`
  `getClientProperty(String key)`
  The client properties are a useful way to associate meta-data with a command without subclassing
  `String`
  `getCommandName()`
  gets the Command Name
  `Image`
  `getDisabledIcon()`
  Indicates the icon that is displayed on the button when the button is in the disabled state
  `Image`
  `getIcon()`
  Returns the icon representing the command
  `Font`
  `getIconFont()`

  ###### Returns

  `float`
  `getIconGapMM()`
  The gap between the text and the icon in millimeters or -1 for default
  `int`
  `getId()`
  Return the command ID
  `char`
  `getMaterialIcon()`

  ###### Returns

  `float`
  `getMaterialIconSize()`

  ###### Returns

  `Image`
  `getPressedIcon()`
  Indicates the icon that is displayed on the button when the button is in pressed state
  `Image`
  `getRolloverIcon()`
  Indicates the icon that is displayed on the button when the button is in rolled over state
  `boolean`
  `isDisposesDialog()`
  Indicates whether this command causes the dialog to dispose implicitly, defaults to true
  `boolean`
  `isEnabled()`
  Allows disabling/enabling the command
  `void`
  `putClientProperty(String key, Object value)`
  The client properties are a useful way to associate meta-data with a command without sub classing
  `void`
  `setCommandName(String command)`
  sets the Command name
  `void`
  `setDisabledIcon(Image disabledIcon)`
  Indicates the icon that is displayed on the button when the button is in the disabled state
  `void`
  `setDisposesDialog(boolean disposesDialog)`
  Indicates whether this command causes the dialog to dispose implicitly, defaults to true
  `void`
  `setEnabled(boolean enabled)`
  Allows disabling/enabling the command
  `void`
  `setIcon(Image icon)`
  Sets the icon for the command
  `void`
  `setIconFont(Font iconFont)`

  ###### Parameters

  `void`
  `setIconGapMM(float iconGapMM)`
  The gap between the text and the icon in millimeters or -1 for default
  `void`
  `setMaterialIcon(char materialIcon)`

  ###### Parameters

  `void`
  `setMaterialIconSize(float materialIconSize)`

  ###### Parameters

  `void`
  `setPressedIcon(Image pressedIcon)`
  Indicates the icon that is displayed on the button when the button is in pressed state
  `void`
  `setRolloverIcon(Image rolloverIcon)`
  Indicates the icon that is displayed on the button when the button is in rolled over state
  `String`
  `toString()`
  Returns a string representation of the object

  ### Methods inherited from class Object

  `clone, getClass, notify, notifyAll, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `protected Object`
  `clone()`
  `final Class`
  `getClass()`
  Returns the runtime class of an object.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `final void`
  `wait()`
  Causes current thread to wait until another thread invokes the method or the method for this object.
  `final void`
  `wait(long timeout)`
  Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.
  `final void`
  `wait(long timeout, int nanos)`
  Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.

- ## Constructor Details

  - ### NavigationCommand

    public NavigationCommand(String command)

    Creates a new instance of NavigationCommand

    ###### Parameters

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

  - ### NavigationCommand

    public NavigationCommand(String command, Image icon)

    Creates a new instance of NavigationCommand

    ###### Parameters

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

    - `icon`: the icon representing the command

  - ### NavigationCommand

    public NavigationCommand(String command, int id)

    Creates a new instance of NavigationCommand

    ###### Parameters

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

    - `id`: @param id user defined ID for a command simplifying switch statement code working with a command

  - ### NavigationCommand

    public NavigationCommand(String command, Image icon, int id)

    Creates a new instance of NavigationCommand

    ###### Parameters

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

    - `icon`: the icon representing the command

    - `id`: @param id user defined ID for a command simplifying switch statement code working with a command

- ## Method Details

  - ### getNextForm

    public Form getNextForm()

    Gets the next Form

    ###### Returns

    the next Form

  - ### setNextForm

    public void setNextForm(Form nextForm)

    Sets the Form to navigate to when the actionPerformed is invoked on this Command

    ###### Parameters

    - `nextForm`: The next Form

  - ### equals

    public boolean equals(Object o)
    Description copied from class: `Command`

    compare two commands

    ###### Parameters

    - `obj`: a Command Object to compare

    ###### Returns

    true if the obj has the same command name

    Overrides:
      `equals` in class `Command`

  - ### hashCode

    public int hashCode()

    Allows storing commands in a vector/hashtable

    ###### Returns

    unique hashcode for the command class

    Overrides:
      `hashCode` in class `Command`

  - ### actionPerformed

    public void actionPerformed(ActionEvent evt)
    Description copied from class: `Command`

    This method is called when the soft button/Menu item is clicked

    ###### Parameters

    - `evt`: the Event Object
    Specified by:
      `actionPerformed` in interface `ActionListener<ActionEvent>`
    Overrides:
      `actionPerformed` in class `Command`