class KL extends KeyAdapter {
public void keyPressed(KeyEvent e)
{
char c = e.getKeyChar();
if (c==KeyEvent.VK_SPACE) {
c = KeyEvent.VK_TAB;
e.setKeyChar(c);
}
This didn't seems to work!
It didn't work because it is not an instance of a KeyAdapter, it is a
KeyAdapter class definition. You must make one. Saying how the class is
defined is not enough.
It is the difference between owning a blueprint for a car, and actually
driving that car.
--
Paul Lutus
www.arachnoid.com
Well, you didn't either say that or post the code.
> Trust me, the following three lines of code just works fine inside the
> KeyAdapter.
> c = Character.toUpperCase(c);
> e.setKeyChar(c); //Must call this to set the new char
> System.out.println(c);
Trust me, you need to post the code that is at issue. Without this code, the
issue is its absence.
> But not the VK_TAB key.
The tab key is handled separately, by the focus manager. Read some recent
posts on this issue:
http://groups.google.com/groups?q=java+%22focus+manager%22+%22Tab+key%22&hl=
en
--
Paul Lutus
www.arachnoid.com