Java-check if control key is being pressed

java, swing

Solution

use the "isControlDown()" boolean:

public void keyPressed (KeyEvent e)
{
     System.out.println(e.isControlDown());
}

Problem

I have a Java function in which I want to test if the control key is being held down. How can I do that? Edit: I am using swing for gui.

Original source

Related problems