Ekkmanz in geeky life!

21 กันยายน 2010

SwingBuilder: Accessing Swing component based on “ID”

Filed under: personal — ekkman @ 17:00

ไม่ได้เขียนมานานล่ะ วันนี้มีเรื่องให้โน้ตเลยสักหน่อยแล้วกันเพราะเวลาเขียน Groovy SwingBuilder มันหา method แอบยาก

เวลาเขียน SwingBuilder แล้วปกติพอเวลาจะ add component ชื่อตัวแปรมันก็จะอยู่ในสโคปของ closure พออยู่นอก scope ก็หาไม่เจอ วิธีแก้คือใช้ id อ้างอิง แล้วใช้ method getVariable(id) ในการเรียก element เอา คิดง่ายๆ ว่าเหมือนกับเขียน HTML แล้วใช้ getElementById()

ให้ความเห็น »

ยังไม่มีความเห็น

RSS feed สำหรับความเห็นต่อเรื่องนี้ TrackBack URI

ใส่ความเห็น

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / เปลี่ยนแปลง )

Twitter picture

You are commenting using your Twitter account. Log Out / เปลี่ยนแปลง )

Facebook photo

You are commenting using your Facebook account. Log Out / เปลี่ยนแปลง )

Connecting to %s

Theme: Rubric. บลอกที่ WordPress.com .

Follow

Get every new post delivered to your Inbox.