calling an actionlistener from another actionlistener
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(...) );
精彩评论