public void updateFrame() {
		if (isHidden()) {
			return;
		}
		setCurrentFrame(nextIndex);
		if (alternate) {
		if (direction)
			nextIndex++;
		else
			nextIndex--;
		if (nextIndex >= getTotalFrames()) {
			direction = false;
			nextIndex--;
		}
		if (nextIndex == -1) {
			direction = true;
			nextIndex = 0;
		}
		}
		else {
			if (nextIndex >= getTotalFrames() - 1) {
				nextIndex = 0;
			}
			else
				nextIndex++;
		}
	}