public class Command extends Object implements ActionListener
Constructor and Description |
---|
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
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent evt)
This method is called when the soft button/Menu item is clicked
|
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.
|
boolean |
equals(Object obj)
compare two commands
|
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() |
float |
getIconGapMM()
The gap between the text and the icon in millimeters or -1 for default
|
int |
getId()
Return the command ID
|
char |
getMaterialIcon() |
float |
getMaterialIconSize() |
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
|
int |
hashCode()
Allows storing commands in a vector/hashtable
|
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) |
void |
setIconGapMM(float iconGapMM)
The gap between the text and the icon in millimeters or -1 for default
|
void |
setMaterialIcon(char materialIcon) |
void |
setMaterialIconSize(float materialIconSize) |
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
|
public Command(String command)
command
- the string that will be placed on the Soft buttons\Menupublic Command(String command, Image icon)
command
- the string that will be placed on the Soft buttons\Menuicon
- the icon representing the commandpublic Command(String command, int id)
command
- the string that will be placed on the Soft buttons\Menuid
- user defined ID for a command simplifying switch statement code
working with a commandpublic Command(String command, Image icon, int id)
command
- the string that will be placed on the Soft buttons\Menuicon
- the icon representing the commandid
- user defined ID for a command simplifying switch statement code
working with a commandpublic int getId()
public String getCommandName()
public void setCommandName(String command)
command
- public Image getIcon()
public void setIcon(Image icon)
icon
- the new iconpublic String toString()
public Image getPressedIcon()
public Image getDisabledIcon()
public Image getRolloverIcon()
public void setRolloverIcon(Image rolloverIcon)
rolloverIcon
- icon to usepublic void setPressedIcon(Image pressedIcon)
pressedIcon
- icon usedpublic void setDisabledIcon(Image disabledIcon)
disabledIcon
- icon usedpublic boolean equals(Object obj)
public int hashCode()
public void actionPerformed(ActionEvent evt)
actionPerformed
in interface ActionListener
evt
- the Event Objectpublic void setDisposesDialog(boolean disposesDialog)
public boolean isDisposesDialog()
public boolean isEnabled()
public void setEnabled(boolean enabled)
enabled
- the enabled to setpublic Object getClientProperty(String key)
key
- an arbitrary user keypublic void putClientProperty(String key, Object value)
key
- an arbitrary user keyvalue
- an arbitrary user object, null to removepublic static Command create(String name, Image icon, ActionListener ev)
name
- the name/title of the commandicon
- the icon for the commandev
- the even handlerpublic static Command createMaterial(String name, char icon, ActionListener ev)
name
- the name/title of the commandicon
- the icon for the commandev
- the even handlerpublic char getMaterialIcon()
public void setMaterialIcon(char materialIcon)
materialIcon
- the materialIcon to setpublic float getIconGapMM()
public void setIconGapMM(float iconGapMM)
iconGapMM
- the iconGapMM to setpublic float getMaterialIconSize()
public void setMaterialIconSize(float materialIconSize)
materialIconSize
- the materialIconSize to setpublic Font getIconFont()
public void setIconFont(Font iconFont)
iconFont
- use iconFont for material icons instead of the system default MaterialDesign font