public void Animate() {
        int numfiles = filenames.length;
        animationState++;
        if (animationState == numfiles) {
            animationState = 0;
        }
        icon = icons[animationState];
        if (behavior == CYCLE) {
            if (count == length) {
                x -= dx * length;
                y -= dy * length;
                count = 0;
            }
            else {
                x += dx;
                y += dy;
                count++;
            }
        }
        if (behavior == BOUNCE) {
            if (current == 1) {
                if (count == length) {
                    current = -1;
                }
                else {
                    x += dx;
                    y += dy;
                    count++;
                }
            }
            else {
                if (count == 0) {
                    current = 1;
                }
                else {
                    x -= dx;
                    y -= dy;
                    count--;
                }
            }
        }
    }