使用小程序的KeyListener不工作 [英] KeyListener not working using Applet
问题描述
我使用的KeyListener小应用程序,但是当我preSS密钥的事件不会被触发..
我还加了setFocusable(真),但并没有太多工作..
I have an applet using a keylistener, but the events are not triggered when I press the keys.. I also add the setFocusable(true), but didn't work too..
下面是我的code
我创建一个新的KeyListener并将其添加到该小程序的对象。
另外我使用我的init()方法setFocusable(真)。
I am creating a new KeyListener and adding it to the applet object. Also I am using setFocusable(true) on my init() method.
我不知道该怎么做多,有人可以看看我的code?谢谢。
I don't know what to do more, can someone take a look at my code? thanks.
非常感谢提前;)
推荐答案
有一个,而(真),内带螺纹的睡眠。击键没有触发正因为如此,我改变了code键启动,而(真)一个新的线程内,现在的工作:)
There was a while(true) with Thread sleep inside it. The keystrokes were not triggered because of that, I changed the code to start the while(true) inside a new Thread and works now :)
感谢所有为您的耐心;)
Thanks all for your patience ;)
这篇关于使用小程序的KeyListener不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!