Help with import AWTKeyStroke and swing.KeyStroke
What do you need to import to instantiate a newly KeyStroke object? Here's the code I have:
Code:
import java.awt.AWTKeyStroke;
import javax.swing.KeyStroke;
...
KeyStroke k = new KeyStroke();
...
System.out.println("Type something: ");
key = k.getKeyStroke();
System.out.println("The key you pressed was: "+key+".\n");
...
When I compile the program I get.
Code:
--------------------Configuration: <Default>--------------------
C:\Documents and Settings\admin\Desktop\KeyLogger.java:19: cannot resolve symbol
symbol : constructor KeyStroke ()
location: class javax.swing.KeyStroke
KeyStroke k = new KeyStroke();
^
C:\Documents and Settings\admin\Desktop\KeyLogger.java:26: cannot resolve symbol
symbol : method getKeyStroke ()
location: class javax.swing.KeyStroke
key = k.getKeyStroke();
Thanks.