Key events and key listeners
Hello again folks. Having trouble with this one. I want to update my JTextArea when a key is presses. Here's a snippet of my code:
Nothing happens when I run it. I want it to print out the value of the key(s) I've pressed. I've gone over the API about a million times but can't see where I'm going wrong. Can you help?
private JTextField myText;
ad = new KeyWatcher();
myText = new JTextField(20);
private class KeyWatcher extends KeyAdapter
public void keyPressed(KeyEvent k)
Thanks in advance.
Re: Key events and key listeners
You're not showing the relevant code, i.e. where do you add your JTextField to your JFrame?