开发者

calling an actionlistener from another actionlistener

开发者 https://www.devze.com 2023-04-10 13:03 出处:网络
I have an actionlistener that fir开发者_开发技巧es when I click a button lets call it box, I have another actionlistener for another button call it restart.What I am trying to do is when I click a box

I have an actionlistener that fir开发者_开发技巧es when I click a button lets call it box, I have another actionlistener for another button call it restart. What I am trying to do is when I click a box button besides calling its own actionlistener inside of that actionlistener I want to call the actionlistener for restart when a certain condition is met. Any ideas?


You could invoke

restart.doClick();

which will click the button which in turn will invoke the ActionListener.

Otherwise you can invoke the ActionListener directly by doing:

restartActionListener.actionPerformed( new ActionEvent(...) );
0

精彩评论

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

关注公众号