Hi,
I am trying to use a SwingBuilder list.
I have a simple window that should have a select all and deselect all button.
However, I don’t see a property that allows me to access all items in the list to have a closure mark them all as selected or deselected.
The only thing I see is that I can do myList.getModel.getElementAt() – but then I cannot do it in a closure.
What are my options here?
Thanks,
David
Wow, that came just in time as I was real close and was having just missing the cast (newbie issue!)
For deselect, there is also this:
list1.selectionModel.clearSelection()
Side question: Does it pay for me to use griffon, if there is no db for my small app? Is there any notable advantage?
Thanks, I will give it a try. It actually is a web start app which took a while until I got the packaging together manually
David
Hi,
I have a simple window created using swingbuilder
I have a few buttons and would like to have the focus on the last button so that the user can hit enter and it closes the window with all the defaults as set.
I have tried defaultButton and selected but neither of these seems to work. Any ideas?
button(action: action(name: 'Select All', closure: {
list1.selectedIndices = (0 .. list1.model.size - 1) as int[]
}))
button(action: action(name: 'DeSelect All', closure:{
list1.selectedIndices = [] as int[]
}))
button(action: action(name: 'OK', defaultButton: true, selected: true,
closure:{
println("button clicked")
list1.selectedValues.each {
println(it)
dispose()
} }))
I am not sure I understand what you are saying.
Is rootPane reserved or the name of my rootPane.
When I took it as is (assuming it was reserved) I get an error:
No such property: rootPane for class: groovy.swing.impl.DefaultAction
From: Tim Yates
[mailto:tim....@gmail.com]
Sent: Wednesday, November 04, 2009
3:42 PM
To: us...@groovy.codehaus.org
I did exactly as you showed me and got the error below
Thanks. I am still not clear – I want to open a dialog on top of main window and set focus to this button. So, when I hit show, I need to have already requested focus for it?
From: Danno Ferrin
[mailto:danno....@shemnon.com]
Sent: Wednesday, November 04, 2009
8:00 PM
To: us...@groovy.codehaus.org
Subject: Re: [groovy-user] default
button in swingbuilder
The "default button" only works when the focus is already on the window but not on any other button, for example:
Sorry, but I am still not clear on this.
If I have a modal dialog (as is my case) then I will not be able to run additional code to set focus. Is there on onFocus of the window?
How do I catch such events in groovy?
Thanks,
David