ViewPort How To

I have a component called Obstacle and I am using it as a component from my mainContentComponent using addAndMakeVisible and setBounds function. I wish to scroll this Obstacle component across my window, with respect to time. I am using a timer and setBounds function to do this.

My understanding is that using setBounds calls the paint function everytime, and that my component is created everytime the paint function is called. I would like to use the viewPort class and pass my component to a viewport object using the setViewedComponent class. I used the API, but I couldn't do much. Can someone point me to examples as to how to use the ViewPort, to scroll my juce::component across the window?

Yes, I saw the Demo. And am still unclear.

Many thanks.