i have the following code
in the model
@Bindable boolean readOnly
in the view
checkBox(text: 'Read Only', constraints:'wrap',selected:bind(target: model, targetProperty:'readOnly'))
in the controller
new groovy.swing.SwingBuilder().frame(title:'File opened',pack:true,show:true){
panel(layout: new MigLayout('fill'), border: titledBorder('Content')){
separator(constraints:"cell 0 1")
textArea(text: part1 , editable: false)
separator(constraints:"cell 0 2")
textArea(text: part2 , editable: false)
separator(constraints:"cell 0 1")
t1 = textArea(text: part3 , editable: "${model.readOnly}",columns:50)
separator(constraints:"cell 0 2")
t2 = textArea(text: part4 , editable: "${model.readOnly}")
separator(constraints:"cell 0 3")
button('Save!', actionPerformed: save, constraints: 'span 5, bottom, right')
}
}
but its always enabled , doesnt matter if checkbox is selected or not.
system.out.println("${model.readOnly}")
shows true
and false
correctly but for some reason on the frame its always set to true
note: also assignment boolean a = "${model.readOnly}"
sets a always to true , or if "${model.readOnly}" == true
or if ("${model.readOnly}")
work as its always true
oh and also setting size in the frame such as
new groovy.swing.SwingBuilder().frame(title:'File opened',pack:true,show:true, size : [640,480]){
doesnt work either