Here is a working example for you. Your variable names were not consistent
and you also did not appear to attach any of the objects you made to the
DOM.
See the "imgContainer" div I referred to in the example. This is just a
dive in the YourModule.html file (for your given module). Images will be
rotated in that div.
/** SAMPLE **/
final List<String> imageURLs = new ArrayList<String>();
// Add image urls to the above list
imageURLs.add("images/image1.png");
imageURLs.add("images/image2.png");
imageURLs.add("images/image3.png");
// make panels to hold images
final Image baseImg = new Image(imageURLs.get(0));
VerticalPanel imgPanel = new VerticalPanel();
imgPanel.add(baseImg);
// attach
RootPanel.get("imgContainer").add(imgPanel);
// create timer
Timer timer = new Timer() {
int index;
@Override
public void run() {
// rotate
index = (index+1<imageURLs.size()) ? index+1 : 0;
baseImg.setUrl( imageURLs.get(index) );
}
};
// schedule rotation of image
timer.scheduleRepeating(1000); //1s
Sincerely,
Joseph
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/8otfpz4QWhYJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.