infinitely looped java.lang.ArrayIndexOutOfBoundsException

java.lang.ArrayIndexOutOfBoundsException: 312

at GalaxyAngelGame.paintFrame(GalaxyAngelGame.java:518)

at GalaxyAngelGame.update(GalaxyAngelGame.java:503)

at sun.awt.RepaintArea.paint(Unknown Source)

at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)

at java.awt.Component.dispatchEventImpl(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

I got this error while I moved an image that was on the applet using keys to an animated image that would display, but disappear. When I moved the one image to the other, I saw part of the image that disappeared, then I would get the error, and it would repeat infinitely. I would like to note that image was animated using a Thread, and is 103 frames long.

Would someone tell me what I could possibly change/add for the animated image to run without error?

EDIT: Also, line 503 is where the paintFrame () method was called, and line 518 is where the image was drawn, just in case that helps anyone.

[1494 byte] By [KuroKyosukea] at [2007-10-2 22:14:36]
# 1

java.lang.ArrayIndexOutOfBoundsException: 312

at GalaxyAngelGame.paintFrame(GalaxyAngelGame.java:518)This is saying that when you draw the image on line 518, you are trying to access an array using an index of 312, but the size of the array is such that 312 is out of bounds.

Somehow your code needs either a larger sized array or needs to detect that the index is too big and handle it.

atmguya at 2007-7-14 1:31:33 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 2
Ah, I see.I looked at my code and realized that I had the counter for the image array go up continuously without stopping. So yeah, thanks.
KuroKyosukea at 2007-7-14 1:31:33 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...