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

MenuItem doesn't accept GStrings as values

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6-rc-1
    • 1.6-rc-2
    • Swing
    • None

    Description

      The following code throws an exception

      import groovy.swing.SwingBuilder
      def i = "One"
      new SwingBuilder().menuItem("Option $i")
      

      java.lang.RuntimeException: Failed to create component for 'menuItem' reason: java.lang.RuntimeException: menuItem can only have a value argument of type javax.swing.Action, javax.swing.Icon, java.lang.String, or javax.swing.JMenuItem

      This may happen in other parts of the builder. A proposed solution is to register a attribute delegate that converts to strings all values that are actually GStrings before the node is instantiated.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: