Java动画,带有关键侦听器 [英] Java animation, with key listener
本文介绍了Java动画,带有关键侦听器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图做到这一点,所以,如果我按向右/向左键,则精灵/马里奥将面对向右/向左.如果我按右键,他将朝右.但是由于某种原因,当我按左键时,他不会面对左.
I tried to make it so that,if I pressed the right/left key, the sprite/Mario would face right/left. If I pressed the right key, he would face right. But for some reason, When I pressed the left key, he won't face left.
推荐答案
"To fire keyboard events, a component must have the keyboard focus."—How to Write a Key Listener
这篇关于Java动画,带有关键侦听器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文