11. juli 2004 - 20:03Der er
3 kommentarer og 1 løsning
Get a Tab-keypress?
Hello!
I try to indicate a keypress on the TAB-key on my laptop dell inspiron 3800, the computer shouldn't matter. But I do not get any indication at all. On my "Tab"-key it doesn't got the text Tab, instead it got 2 arrows.
But the code below doesn't notice anything at all when I press the arrow key (my Tab):
public class Test extends JPanel implements KeyListener { public Test() { setBackground(Color.red); addKeyListener( this ); setFocusable(true); requestFocus(); }
Of course you could use the KeyBoardFocusManager and add a new KeyEventDispatcher, that gives you the possibility to capture all keyboard events before they hit the component and do whit these events whatever you like.
I've modified yuor Test class a little, to show what happens when you hit the TAB button.
Thanks for your great answer mate! Thanks a lot! Fredrik
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.