开发者

Event handling ideas

I have two classes extended from JPanels and both the panels have buttons which when clicked perform a common activity. What will be the best way to achieve this? Does event delegation enter here? like passing the control to handler on another class? (I have assumed thats what delegation is, if I a开发者_开发知识库m not wrong)(If delegation is suitable pls provide some good study resource). I have also thought of having a common static method and each classes actionPerformed might call that!! Or is there any other better way?


Consider using an Action object, if you have two or more components which perform the same function when acted upon.

Take a look at the Tutorial | How to Use Actions for more information.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜