But I have another problem, I am having a JPanel in which I have added a ImageLabel (which have a ImageIcon say "a.jpg") on a button click I am saving a image with same name "a.jpg" but the image on the Label and then Panel remain same (the previous one).
I want that when I click on some button, the image of ImageIcon gets change.
Initially I am having
Label_Image_Center =new JLabel(new ImageIcon("h3.jpg")); Panel_Image.add(Label_Image_Center, new XYConstraints(19, 65, 123,141));
after clicking on button different images saves as "h3.jpg". Now, I am doing
Label_Image_Center.setIcon(new ImageIcon("h3.jpg")); Panel_Image.add(Label_Image_Center, new XYConstraints(19, 65, 123,141));
but the image gets not change while when I open it(image) outside it show different image.
Joined: Jan 14, 2004
There are two ways you can do this. One way is to make up a new JLabel with a new ImageIcon with the next image you want to show, remove the existing JLabel from the gui and add the new JLabel. The other way is demonstrated below.
Joined: Jul 31, 2004
Hi! Thanks for your prompt reply............... I am working on Cell Phone,I am getting Phone Screen image but in PPM (Portable Pixmaps) format, then I am converting it into JPG then resizing it into smaller size and then try to set it as a ImageIcon,so that each time whenever screen of Phone changes that ImageIcon on the Label also gets change. But the method I am apply taking so much time,is there any method in which I will take less time.