# 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().

- ## Field Summary

  ### Fields inherited from class Command

  `DESKTOP_MENU, DESKTOP_MENU_ABOUT, DESKTOP_MENU_APP, DESKTOP_MENU_EDIT, DESKTOP_MENU_FILE, DESKTOP_MENU_HELP, DESKTOP_MENU_PREFERENCES, DESKTOP_MENU_QUIT, DESKTOP_MENU_VIEW, DESKTOP_MENU_WINDOW`

- ## 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, getDesktopMenu, getDisabledIcon, getIcon, getIconFont, getIconGapMM, getId, getMaterialIcon, getMaterialIconSize, getPressedIcon, getRolloverIcon, isDisposesDialog, isEnabled, putClientProperty, setCommandName, setDesktopMenu, setDisabledIcon, setDisposesDialog, setEnabled, setIcon, setIconFont, setIconGapMM, setMaterialIcon, setMaterialIconSize, setPressedIcon, setRolloverIcon, toString`

  ### Methods inherited from class Object

  `clone, getClass, notify, notifyAll, wait, wait, wait`

- ## 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`