0

是否可以绑定到地图元素?

mybean = new MyBean()
swing.edt {
  dialog() {
    vbox(){
      label(text: '> Please enter your developer account')
      def tf = textField(columns:10)
      bean mybean, myMap.myKey: bind {tf.text}
      button(defaultButton: true, text: 'OK', actionPerformed: {dispose() },
        enabled: bind {new File(userBean.myMap.myKey).exists()})
    }
  }
}

@Bindable
class MyBean {
Map<String,String> myMap
}

或者,也许我这样做是错误的。只有在文本字段中输入的内容有效时,我才想启用 OK 按钮。我想将文本字段的内容存储在 myBean bean 的 myMap 映射的特定键中,然后检查文件是否存在

4

0 回答 0