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

Order of rows and cols for GridLayout causes incorrect parsing of these arguments

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 1.7.3
    • None
    • Swing
    • None
    • Linux misha-d630 2.6.32-22-generic #36-Ubuntu SMP Thu Jun 3 19:31:57 UTC 2010 x86_64 GNU/Linux

    Description

      Dear All:

      My apologies for bothering - I am trying a SwingBuilder example from here:
      http://kousenit.wordpress.com/2008/09/29/making-swing-groovy-part-i/

      If I use as is:

      #!/usr/bin/env groovy
      
      	import groovy.swing.SwingBuilder
      	import javax.swing.WindowConstants as WC
      	 
      	SwingBuilder.build() {
      	    frame(title:'Echo GUI', size:[300,100],
      	        visible:true, defaultCloseOperation:WC.EXIT_ON_CLOSE) {
      	        gridLayout(rows: 0, cols: 2)
      	        label 'Input text: '
      	        input = textField(columns:10,
      	            actionPerformed: { output.text = input.text })
      	        label 'Echo: '
      	        output = label()
      	    }
      	}
      

      I get:
      Caught: java.lang.IllegalArgumentException: rows and cols cannot both be zero
      at test$_run_closure1_closure2.doCall(test.groovy:9)
      at test$_run_closure1_closure2.doCall(test.groovy)
      at test$_run_closure1.doCall(test.groovy:7)
      at groovy.swing.SwingBuilder$_edt_closure1.doCall(SwingBuilder.groovy:269)
      at groovy.swing.SwingBuilder$_edt_closure1.doCall(SwingBuilder.groovy)

      However, if I just switch the order of rows and cols, all works well!

      #!/usr/bin/env groovy
      
      	import groovy.swing.SwingBuilder
      	import javax.swing.WindowConstants as WC
      	 
      	SwingBuilder.build() {
      	    frame(title:'Echo GUI', size:[300,100],
      	        visible:true, defaultCloseOperation:WC.EXIT_ON_CLOSE) {
      	        gridLayout(cols: 2, rows: 0)
      	        label 'Input text: '
      	        input = textField(columns:10,
      	            actionPerformed: { output.text = input.text })
      	        label 'Echo: '
      	        output = label()
      	    }
      	}
      

      This seem quite odd to me...

      Attachments

        Activity

          People

            roshandawrani Roshan Dawrani
            misha680 Misha Koshelev
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: