I want to detect if the user has pressed a combination of 3 or more keyboard buttons in Java Swing. For example, if the user has used a combination like Ctrl+Alt+R or Ctrl+Shift+Alt+R.
So far what I found over the internet is mentioned below.
public void keyTyped(KeyEvent e)<br>{<br>
AWTKeyStroke ak = AWTKeyStroke.getAWTKeyStrokeForEvent(e);
if(ak.equals(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_F4,InputEvent.ALT_MASK)))
{
System.exit(0);
}
But the problem with the above code is that it works fine for a combination of 2 buttons only but not for 3 or more buttons.
Please suggest a solution.