i want key code for b+n combined, so that function works only when first b key is pressed and then n is pressed happens. if only n is pressed another function should happen.

Plz help thanks

commented: h +0

You should keep a boolean flag as a member variable inside your keyboard listener. It should work similar to "shift," "ctrl," and "alt" keys. If a specific key is pressed, turn the flag to true. Then when the next key is pressed, check whether the specific key flag is true. If it is true and the newly key value is what you want, then process what you are going to do; otherwise, reset the flag for the specific key to false.

One thing I am not sure is that if you press & hold a key which is not one of shift, ctrl, and alt, the keyboard listener would allow the 2nd key to be entered. However, I don't see that the keyboard event listener would prevent you from doing so anyway.