JButton があり、2 つのアクション リスナーが登録されています。Listener1
最初に登録されるため、最初に実行されます。だから、私が必要とするのは、条件が一致するListener1
場合、コードは Listener2
実行されるべきではありません。Listener1 で条件が一致した場合に Listener2 の実行を防ぐ方法を教えてください。
JButton jbtn=new JButton();
jbtn.addActionListener(new ActionListener() {
//Listener1
public void actionPerformed(ActionEvent e)
{
if(condition==true){
//do not execute the code of listner2
//stop further executeion of current action
}
}
});
jbtn.addActionListener(new ActionListener() {
//Listener2
public void actionPerformed(ActionEvent e)
{
//some code
}
});