Groovy学习笔记-实现接口
时间:2017-07-27 15:39:41
收藏:0
阅读:289
1.单个委托方法的实现
button.addActionListener( { println ‘Implement ActionListener‘ } as ActionListener )
2.实现接口中的多个方法:使用映射,以每个方法的名字作为键,以方法对应的代码块作为键值,使用:分割方法名和代码块
handleFocus = [ focusGained : {msgLabel.setText("Good to see you")}, focusLost : {msgLabel.setText("Come back soon")} ] button.addFocusListener(handleFocus as FocusListener)
原文:http://www.cnblogs.com/ironcrow/p/7244694.html
评论(0)