Timing with Swing animation

前端 未结 3 854
执笔经年
执笔经年 2020-12-04 03:40

i have some problems with Swing and animate a character, I Have a JFrame with key listener and when the user hit down,it calls my JPanel method here

for(int          


        
3条回答
  •  情歌与酒
    2020-12-04 03:50

    1. don't extend JFrame, create JFrame as local variable

    2. don't use KeyListener, use KeyBindings instead

    3. don't paint directly to the JFrame, use drawImage() to the JLabel or JComponent/JPanel

    4. This animate my character but so fast that we can see a thing,how do i can do to view the animation?

    another issue with KeyListener, you have to set for delay betweens two KeyEvents

提交回复
热议问题