ask_123
01-31-2005, 12:03 PM
I am coding an applet application which contains some basic AWT componets, such as TextField, TextArea.
Due to the specific application, users can only use the KB to interact with the GUI. For example, press 'P' to set focus to one of the text field and input information, press enter to connect to a database ..etc.
My applet implement the KeyListener and the code is like this
TextField tf = new TextField(20);
public void init() {
...
this.add(tf);
addKeyListener(this);
...
}
public void ketTyped(KeyEvent e) {
tf.requestFocus();
tf.setText("The text.");
}
However, these do not work, the applet is not responding to any kettyped. Anybody can give me any suggestion?
Thanks in advance
ALex
Due to the specific application, users can only use the KB to interact with the GUI. For example, press 'P' to set focus to one of the text field and input information, press enter to connect to a database ..etc.
My applet implement the KeyListener and the code is like this
TextField tf = new TextField(20);
public void init() {
...
this.add(tf);
addKeyListener(this);
...
}
public void ketTyped(KeyEvent e) {
tf.requestFocus();
tf.setText("The text.");
}
However, these do not work, the applet is not responding to any kettyped. Anybody can give me any suggestion?
Thanks in advance
ALex