forward button
hi there!
i've been asked to load pictures on a panel and put a button that will help me move to the next picture every time it's pressed! i found the way to load the images with the media tracker but i don't know how to go from one picture to another. it would be nice if you gave me any ideas!
thanks :)
[328 byte] By [
penepepea] at [2007-11-27 9:15:55]

0. Aside: use javax.imageio.ImageIO to read images:
BufferedImage im = ImageIO.read(url_or_file_or_etc);
There is no need to use the old java.awt.MediaTracker in this case!
1. Maintain a java.util.List of images and the index of the current image
2. Display the current image in a JLabel, if you like.
3. When the forward button is pressed, increment the index, with wrap-around.
Call setIcon on the label.
(Notice the smooth back-and-forth between me and georgemc!)