You mix key code and modifiers :
if(k.getKeyCode()==KeyEvent.VK_A
&& (k.getModifiers & KeyEvent.CTRL_MASK==KeyEvent.CTRL_MASK))
But more generally, it is better to use KeyBindings instead of KeyListener. It will make your life a lot easier and allow you to do such tests.
1.Create an action as follows:
public class MyAction extends AbstractAction {
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(null, "OK");
}
}
2. :
check.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_MASK), "doSomething");
check.getActionMap().put("doSomething", new MyAction());
: , , , .