java - ActionListener - Tracing if actionPerformed is called inside actionPerformed method? -
say have 'select' jbutton selectpiecelistener. want check if action(clicking select button) performed again or not. however, actionperformed void, cannot use boolean expression.
is there way that? or better use jbutton handle this?
thank you.
public class selectpiecelistener implements actionlistener { @override public void actionperformed(actionevent e) { if(c == _st.checkmoveimpossible()) { system.out.println("no possible move "+nextplayer+": click select skip turn, " + "or click right move " + t + " pieces."); if(**the action performed**){_board.setcmi(1);} _board.update(); }
do want know if select button has been clicked once (1) ? or want make sure actionperformed method isn't called recursively (2)?
(1) add boolean field selectpiecelistener called 'selectpressed' (or whatever), , set true when actionperformed called.
(2) no worries, don't seem call manually.
Comments
Post a Comment