[groovy-user] GridLayout bug?

1 view
Skip to first unread message

Misha Koshelev

unread,
Jun 16, 2010, 11:19:04 PM6/16/10
to user
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...

Just in case I have filed a bug report
http://jira.codehaus.org/browse/GROOVY-4251

Thank you!

Misha


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Roshan Dawrani

unread,
Jun 17, 2010, 1:05:53 AM6/17/10
to us...@groovy.codehaus.org
Hi. replied on your JIRA issue to explain the behavior.
Reply all
Reply to author
Forward
0 new messages