Java GUI Lesson 9 | Animation With Frames

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
6,584
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Apr 2, 2010

a simple way for doing animation in java with 15 frames

  • likes, 0 dislikes

Link to this comment:

Share to:

Uploader Comments (macheads101)

  • Well the problem is i get only 14 indexes registered not 15.

  • @EldarMK2 just subtract one from the maximum in the loop, I guess.

Top Comments

  • Hey thanks a lot for the tutorials, I  learned a lot. Just in case anyone was wondering, you can get rid of the run-time errors by swapping lines 24 and 25.

see all

All Comments (16)

Sign In or Sign Up now to post a comment!
  • Ive solved the error. The problem is in the paintcomponent method you should take the currentframe++; above the if statment. so first it incremets the frame then it test is current frame biger or equals otherwise the error will be

  • @macheads101 nope,doesnt help

  • By the same construction of the for loop, i got an array out of range error. I mean i gets ++ till its smaller the array.lenght wich is 15 if "i" gets 15 the loop will stop but at the las it will make i++ and so the program try to operate with array index 16 that is not available.... how can i solve that error ?

  • whenever i type extends jframe implements actionlistener it says java interface needed and anytime there is jframe it says not found. whats wrong with it .i'm using a hp computer, help pls

  • 8:50 - an errors.

  • I always get an error at animator = new Timer(delay, this); but I have my delay int and my implement -.-

  • @DLNebelim

    Yeah it appears to skip a frame.

    He should increment after painting.

  • I was wondering, because you placed counter++ before the call to paint the icon, would this program never actually paint frame 1, that's stored in index 0 of imageArray?

    Thanks for the tutorial

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more