public void nextFrame() {

		if (loopCount < 0)
			return;
		int n = images != null ? images.length : 0;
		if (n <= 1)
			return;
		if (gifDecoder == null)
			return;

		currentTime = System.currentTimeMillis();
		if (previousFrameTime != 0L) {
			if (currentTime - previousFrameTime >= getDelayTime(frameCounter)) {
				frameCounter++;
				if (frameCounter == n) {
					if (loopCount == 0) {
						frameCounter = 0;
					}
					else {
						if (loopCounter < loopCount - 1) {
							frameCounter = 0;
							loopCounter++;
						}
						else {
							frameCounter = n - 1;
						}
					}
				}
				previousFrameTime = currentTime;
			}
		}
		else {
			previousFrameTime = currentTime;
		}

	}