Did it! here's the code of an Applet, all it does is show a textfield and when you press Alt(but no Ctrl)-t it will switch the focus to the TextField:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class test extends Applet implements KeyListener
{
public TextField tF=new TextField();
public void init()
{
add(tF);
this.addKeyListener(this);
}
public void keyTyped(KeyEvent ke) {}
public void keyPressed(KeyEvent ke)
{
if((ke.getKeyChar=='t' || ke.getKeyChar=='t') && ke.isAltDown && !ke.isControlDown)
tF.requestFocus();
}
public void keyReleased(KeyEvent ke) {}
}
You need to recursivly add a keylistener to all of the components, (and update it romving/adding) when components are added/removed set invisible/visible...)
this keylistener could contain a map of all components that has a shortcut key linkt to it. It then calls requestFocus() on the that component when the spesific key is hit. Then you need some graphics overriding to display the components, and maybe some handeling of multiple equal shortcuts...
A lot of work?
yes, but it works (done it myself) and its reusable.
";-)
Ragnvald Barth
Software engineer