Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-3459

SwingBuilder: add a method to handle key related input actions

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6.1
    • 1.6.3, 1.7-beta-1
    • Swing
    • None

    Description

      Registering a key-related input action with Swing is a two liner

      actions {
         action(id: "viewScriptAction",
            name: "View",
            mnemonic: "V",
            accelerator: shortcut("V"),
            keyStroke: shortcut("ENTER"),
            shortDescription: "View selected Script",
            closure: controller.viewScript)
      }
      ...
      scriptsTable.getInputMap(JComponent.WHEN_FOCUSED).put(shortcut("ENTER"), "viewScript")
      scriptsTable.actionMap.put("viewScript", viewScriptAction)
      

      It should be possible to create a method that makes this task easier and more intuitive like

      keyStrokeAction(scriptsTable, keyStroke: shortcut("ENTER"), action: viewScriptAction)
      

      Note: this feature has been prototyped on the Griffon codebase

      Attachments

        Activity

          People

            aalmiray Andres Almiray
            aalmiray Andres Almiray
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: