Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Trivial
-
Resolution: Fixed
-
Affects Version/s: 1.0-beta-4
-
Fix Version/s: 1.0-beta-6
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
In order to create an action with an accelerator key, it is necessary to pass it an javax.swing.KeyStroke. It would be more convinient if the action could receive a string and convert it to a KeyStroke automatically.
Currently:
action( name: "Exit",
keyStroke: new javax.swing.KeyStroke( "control X" ),
closure: { System.exit(0) }
)
After improvement:
action( name: "Exit",
keyStroke: "control X",
closure: { System.exit(0) }
)
Patch is in
GROOVY-333.Use "accelerator:" to add. If the object is a javax.swing.KeyStroke then it will be used literally. If it anything else, it will be toString()ed and passed through KeyStroke.getKeyStroke(string). Badly formatted values will result in no accelerator set, i.e. using non-lowe case for a modifier or lower case for the key.
GROOVY-333. Use "accelerator:" to add. If the object is a javax.swing.KeyStroke then it will be used literally. If it anything else, it will be toString()ed and passed through KeyStroke.getKeyStroke(string). Badly formatted values will result in no accelerator set, i.e. using non-lowe case for a modifier or lower case for the key.