How to update ImageIcon for Pic Browser?

I'm trying to build a very simple picture browser from JApplet to improve my Java skills. There is just a picture, next, previous, last and first buttons.

I have an ImageIcon in a JLabel which is then added to a JScrollPane

Initially the the Applet runs fine displaying a picture as defualt set by:

thePic = new ImageIcon(theNames[0]); // name is array of piture names

I'm trying to get the ImageIcon to update when the Last button is pressed. I know how to find the last picture name in the array but I don't know how to redraw the ImageIcon.

I am not currently using the paint or update methods. Do I need to?

Here is a sample of some of the code I'm trying to use in the actionPerformed, but this needs Image not ImageIcon.

thePic.setImage(last);

Can someone please tell/show me how to update the ImageIcon.

Any help much appreciated.

from Phil

[918 byte] By [phil_mccarthy_uk] at [2007-9-27 17:29:46]
# 1
thePic.setImage(new ImageIcon(last).getImage());orthePic.setImage(Toolkit.getDefaultToolkit().createImage(pathToFile));best regardsStas
StanislavL at 2007-7-6 12:35:53 > top of Java-index,Archived Forums,Swing...