public MyApplet extends Applet implements KeyListener
{
public MyApplet() {}
public void init()
{
addKeyListener( this );
}
public void keyTyped(KeyEvent e) {}
public void keyPressed(KeyEvent e) {}
public void keyReleased(KeyEvent e) {}
}
Yes, I do stuff in the keyTyped and other methods, i just cut it out to make the code block a bit smaller
Anyway, it doesn''t work! I never recieve any KeyEvent:s and the key* methods never gets called. (I also use the MouseListener with its corresponding methods (addMouseListener, mouseClicked and so on), and that works fine)
Have I missed something? Is there any other way to get keyboard input notification?
[java] Keyboard input
In my applet, I want to monitor keyboard input. So I implement the KeyListener interface
-------------------------------------------------------------LGPL 3D engine - http://www.sourceforge.net/projects/realityengine
Yeah, you''re forgetting to call requestFocus() - either call it in the init() method or when the user clicks on the applet.
JP.
==============================================
I feel like a kid in some kind of store...
==============================================
www.thejpsystem.com
JP.
==============================================
I feel like a kid in some kind of store...
==============================================
www.thejpsystem.com
==============================================I feel like a kid in some kind of store... ============================================== www.thejpsystem.com
Thanks, that did the trick!
-------------------------------------------------------------LGPL 3D engine - http://www.sourceforge.net/projects/realityengine
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement