Class NavigationCommand
java.lang.Object
com.codename1.ui.Command
com.codename1.ui.NavigationCommand
- All Implemented Interfaces:
ActionListener<ActionEvent>
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
ConstructorsConstructorDescriptionNavigationCommand(String command) Creates a new instance of NavigationCommandNavigationCommand(String command, int id) Creates a new instance of NavigationCommandNavigationCommand(String command, Image icon) Creates a new instance of NavigationCommandNavigationCommand(String command, Image icon, int id) Creates a new instance of NavigationCommand -
Method Summary
Modifier and TypeMethodDescriptionvoidThis method is called when the soft button/Menu item is clickedbooleancompare two commandsGets the next ForminthashCode()Allows storing commands in a vector/hashtablevoidsetNextForm(Form nextForm) Sets the Form to navigate to when the actionPerformed is invoked on this CommandMethods 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, toStringModifier and TypeMethodDescriptionstatic Commandcreate(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 CommandcreateMaterial(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.getClientProperty(String key) The client properties are a useful way to associate meta-data with a command without subclassinggets the Command NameIndicates the icon that is displayed on the button when the button is in the disabled stategetIcon()Returns the icon representing the commandReturns
floatThe gap between the text and the icon in millimeters or -1 for defaultintgetId()Return the command IDcharReturns
floatReturns
Indicates the icon that is displayed on the button when the button is in pressed stateIndicates the icon that is displayed on the button when the button is in rolled over statebooleanIndicates whether this command causes the dialog to dispose implicitly, defaults to truebooleanAllows disabling/enabling the commandvoidputClientProperty(String key, Object value) The client properties are a useful way to associate meta-data with a command without sub classingvoidsetCommandName(String command) sets the Command namevoidsetDisabledIcon(Image disabledIcon) Indicates the icon that is displayed on the button when the button is in the disabled statevoidsetDisposesDialog(boolean disposesDialog) Indicates whether this command causes the dialog to dispose implicitly, defaults to truevoidsetEnabled(boolean enabled) Allows disabling/enabling the commandvoidSets the icon for the commandvoidsetIconFont(Font iconFont) Parameters
voidsetIconGapMM(float iconGapMM) The gap between the text and the icon in millimeters or -1 for defaultvoidsetMaterialIcon(char materialIcon) Parameters
voidsetMaterialIconSize(float materialIconSize) Parameters
voidsetPressedIcon(Image pressedIcon) Indicates the icon that is displayed on the button when the button is in pressed statevoidsetRolloverIcon(Image rolloverIcon) Indicates the icon that is displayed on the button when the button is in rolled over statetoString()Returns a string representation of the objectMethods inherited from class Object
clone, getClass, notify, notifyAll, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()final ClassgetClass()Returns the runtime class of an object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.final voidwait()Causes current thread to wait until another thread invokes the method or the method for this object.final voidwait(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 voidwait(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
Creates a new instance of NavigationCommand
Parameters
command: the string that will be placed on the Soft buttons\Menu
-
NavigationCommand
-
NavigationCommand
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
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
Gets the next Form
Returns
the next Form
-
setNextForm
Sets the Form to navigate to when the actionPerformed is invoked on this Command
Parameters
nextForm: The next Form
-
equals
-
hashCode
-
actionPerformed
Description copied from class:CommandThis method is called when the soft button/Menu item is clicked
Parameters
evt: the Event Object
- Specified by:
actionPerformedin interfaceActionListener<ActionEvent>- Overrides:
actionPerformedin classCommand
-