File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Applets and the fly likes Displaying image in applet on click event Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Displaying image in applet on click event" Watch "Displaying image in applet on click event" New topic

Displaying image in applet on click event

Khushwinder Chahal
Ranch Hand

Joined: Oct 03, 2007
Posts: 128
Hi All,

I need your help in the following problem:
I have an applet in which i am displaying my images after selecting them from a dialog box. It is displaying all the images in the applet (i am also providing the code below).
Now i want to enhance its functionality.
I want that if i select 2 images from the dialog box it should display one of them and then if i click on the next button(which i created on the same frame) it should display the next image.
For this i am storing all my selected images in a buffered image and then retrieving one by one on clicking the next button.
But in my case the image is not changing. It is remaining as the first image.
The following is the code i have :

If anybody has any idea please help me.
Thanks in advance.

Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 692
Look at these two lines from the actionPerformed() method.
The variable image is also declared at the class level!
So where does the second statement below put its value? local or class

Also your variable names could be changed for easier reading/understanding.
EG use openBtn vs button or nextBtn vs button1
[ June 19, 2008: Message edited by: Norm Radder ]
I agree. Here's the link:
subject: Displaying image in applet on click event
It's not a secret anymore!