@SuppressWarnings("unchecked")
    public void addControlAt(int index, Control control) {
        if (control == null) {
            throw new IllegalArgumentException("null control");
        }
        int numControls = getNumControls();
        if (index < 0 || index > numControls) {
            throw new IndexOutOfBoundsException(
                    "index=" + index + " for numControls=" + numControls);
        }
        if (controls.contains(control)) {
            throw new IllegalStateException("Control is already added here.");
        }

        addControl(control); // takes care of the bookkeeping

        if (index < numControls) { // re-arrange the list directly
            boolean success = controls.remove(control);
            assert success : "Surprising control remove failure. " + control.getClass().getSimpleName() + " from spatial " + getName();
            controls.add(index, control);
        }
    }
Adds the specified control to the list, at the specified index.  Any
controls with indices greater than or equal to the specified index will
have their indices increased by one.

@param index the index at which to add the control (0&rarr;first, &ge;0)
@param control the control to add (not null)
@throws IllegalStateException if the control is already added here
jme3-core/src/main/java/com/jme3/scene/Spatial.java