>>458
removeKeyListenerとaddKeyListenerで状況に応じて登録しなおすとか、
AKeyListenerとBKeyListenerの方で、それぞれ状態Aか状態Bのときにしか実際の処理をしないようにするとか。