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]
# 1
It would be nice if you could be more specific. What "media tracker"?Ah. AWT has one. No idea how it works, over to big daddy thenMessage was edited by: georgemc
georgemca at 2007-7-12 22:05:24 > top of Java-index,Java Essentials,New To Java...
# 2

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!)

BigDaddyLoveHandlesa at 2007-7-12 22:05:24 > top of Java-index,Java Essentials,New To Java...
# 3
> (Notice the smooth back-and-forth between me and> georgemc!)Too much information.
filestreama at 2007-7-12 22:05:24 > top of Java-index,Java Essentials,New To Java...
# 4
(Notice the smooth back-and-forth between me and georgemc!) what do you mean? is this a joke? :)
penepepea at 2007-7-12 22:05:25 > top of Java-index,Java Essentials,New To Java...
# 5
> > (Notice the smooth back-and-forth between me and> > georgemc!)> > Too much information.I wrote warp-around, not reach-around!
BigDaddyLoveHandlesa at 2007-7-12 22:05:25 > top of Java-index,Java Essentials,New To Java...
# 6
hottt
hunter9000a at 2007-7-12 22:05:25 > top of Java-index,Java Essentials,New To Java...
# 7
> hotttI feel slightly soiled nowmmmm, soiled
georgemca at 2007-7-12 22:05:25 > top of Java-index,Java Essentials,New To Java...