Class Command
- All Implemented Interfaces:
ActionListener<ActionEvent>
- Direct Known Subclasses:
NavigationCommand, ShareService
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringClient property key carrying the desktop native-menu placement hint for this command.static final StringStandard desktop menu placement: an "About" item, conventionally in the application menu.static final StringStandard desktop menu placement: the application menu (macOS app menu / a leading menu).static final StringStandard desktop menu placement: the Edit menu.static final StringStandard desktop menu placement: the File menu.static final StringStandard desktop menu placement: the Help menu.static final StringStandard desktop menu placement: a "Preferences"/"Settings" item in the application menu.static final StringStandard desktop menu placement: a "Quit"/"Exit" item in the application menu.static final StringStandard desktop menu placement: the View menu.static final StringStandard desktop menu placement: the Window menu. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidThis method is called when the soft button/Menu item is clickedstatic 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.booleancompare two commandsgetClientProperty(String key) The client properties are a useful way to associate meta-data with a command without subclassinggets the Command NameReturns the desktop native-menu placement hint, or null when unset.Indicates 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 stateinthashCode()Allows storing commands in a vector/hashtablebooleanIndicates 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 namesetDesktopMenu(String menu) Sets the desktop native-menu placement hint for this command.voidsetDisabledIcon(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 object
-
Field Details
-
DESKTOP_MENU
Client property key carrying the desktop native-menu placement hint for this command. When a desktop app bridges its commands to the native menu bar (title-bar modenative/custom), the value selects which menu the command appears under. Recognized values (case-insensitive):#DESKTOP_MENU_APP,#DESKTOP_MENU_ABOUT,#DESKTOP_MENU_PREFERENCES,#DESKTOP_MENU_QUIT,#DESKTOP_MENU_FILE,#DESKTOP_MENU_EDIT,#DESKTOP_MENU_VIEW,#DESKTOP_MENU_WINDOW,#DESKTOP_MENU_HELP. Any other value becomes a top-level menu with that literal title. Commands without the hint are grouped under a default application-commands menu.- See Also:
-
DESKTOP_MENU_APP
Standard desktop menu placement: the application menu (macOS app menu / a leading menu).- See Also:
-
DESKTOP_MENU_ABOUT
Standard desktop menu placement: an "About" item, conventionally in the application menu.- See Also:
-
DESKTOP_MENU_PREFERENCES
Standard desktop menu placement: a "Preferences"/"Settings" item in the application menu.- See Also:
-
DESKTOP_MENU_QUIT
Standard desktop menu placement: a "Quit"/"Exit" item in the application menu.- See Also:
-
DESKTOP_MENU_FILE
Standard desktop menu placement: the File menu.- See Also:
-
DESKTOP_MENU_EDIT
Standard desktop menu placement: the Edit menu.- See Also:
-
DESKTOP_MENU_VIEW
Standard desktop menu placement: the View menu.- See Also:
-
DESKTOP_MENU_WINDOW
Standard desktop menu placement: the Window menu.- See Also:
-
DESKTOP_MENU_HELP
Standard desktop menu placement: the Help menu.- See Also:
-
-
Constructor Details
-
Command
Creates a new instance of Command
Parameters
command: the string that will be placed on the Soft buttons\Menu
-
Command
-
Command
Creates a new instance of Command
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
-
-
Command
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: @param id user defined ID for a command simplifying switch statement code working with a command
-
-
-
Method Details
-
create
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.
Parameters
-
name: the name/title of the command -
icon: the icon for the command -
ev: the even handler
Returns
a newly created Command instance
-
-
createMaterial
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.
Parameters
-
name: the name/title of the command -
icon: the icon for the command -
ev: the even handler
Returns
a newly created Command instance
Since
6.0
-
-
getId
public int getId()Return the command ID
Returns
the command ID
-
getCommandName
gets the Command Name
Returns
the Command name
-
setCommandName
sets the Command name
Parameters
command
-
getIcon
Returns the icon representing the command
Returns
an icon representing the command
-
setIcon
Sets the icon for the command
Parameters
icon: the new icon
-
toString
-
getPressedIcon
Indicates the icon that is displayed on the button when the button is in pressed state
Returns
icon used
-
setPressedIcon
Indicates the icon that is displayed on the button when the button is in pressed state
Parameters
pressedIcon: icon used
-
getDisabledIcon
Indicates the icon that is displayed on the button when the button is in the disabled state
Returns
icon used
-
setDisabledIcon
Indicates the icon that is displayed on the button when the button is in the disabled state
Parameters
disabledIcon: icon used
-
getRolloverIcon
Indicates the icon that is displayed on the button when the button is in rolled over state
Returns
icon used
-
setRolloverIcon
Indicates the icon that is displayed on the button when the button is in rolled over state
Parameters
rolloverIcon: icon to use
-
equals
-
hashCode
-
actionPerformed
This method is called when the soft button/Menu item is clicked
Parameters
evt: the Event Object
- Specified by:
actionPerformedin interfaceActionListener<ActionEvent>
-
isDisposesDialog
public boolean isDisposesDialog()Indicates whether this command causes the dialog to dispose implicitly, defaults to true -
setDisposesDialog
public void setDisposesDialog(boolean disposesDialog) Indicates whether this command causes the dialog to dispose implicitly, defaults to true -
isEnabled
public boolean isEnabled()Allows disabling/enabling the command
Returns
the enabled
-
setEnabled
public void setEnabled(boolean enabled) Allows disabling/enabling the command
Parameters
enabled: the enabled to set
-
getClientProperty
-
putClientProperty
-
setDesktopMenu
-
getDesktopMenu
Returns the desktop native-menu placement hint, or null when unset. See
#DESKTOP_MENU.Returns
the placement hint or null
-
getMaterialIcon
public char getMaterialIcon()Returns
the materialIcon
-
setMaterialIcon
public void setMaterialIcon(char materialIcon) Parameters
materialIcon: the materialIcon to set
-
getIconGapMM
public float getIconGapMM()The gap between the text and the icon in millimeters or -1 for default
Returns
the iconGapMM
-
setIconGapMM
public void setIconGapMM(float iconGapMM) The gap between the text and the icon in millimeters or -1 for default
Parameters
iconGapMM: the iconGapMM to set
-
getMaterialIconSize
public float getMaterialIconSize()Returns
the materialIconSize
-
setMaterialIconSize
public void setMaterialIconSize(float materialIconSize) Parameters
materialIconSize: the materialIconSize to set
-
getIconFont
Returns
the set iconFont or null if none defined (meaning for material icons instead of the system default MaterialDesign font
-
setIconFont
Parameters
iconFont: use iconFont for material icons instead of the system default MaterialDesign font
-