1
比方說,我宣佈使用SwingBuilder對象如下:獲得從Swing組件ID在Groovy SwingBuilder
swing.button(id:'something')
我知道我可以從SwingBuilder得到Component
回來致電:
swing."something"
但是我怎樣才能從Component
,返回到它的id
作爲一個字符串?
Component c = getMyButton()
String whatIWant = c.id //Property doesn't exist
String attempt2 = c['id'] //Property doesn't exist
你有完整的代碼示例重現呢? – Rao