• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Working with ImageIcon.

 
P Jain
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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". (I mean the images gets change but the name of the image reamins same or we can say that that image is live snapshot which gets change with each button click but saved with same name)
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 on the Label,though when I opens it(image) outside it show different image.
 
Nigel Browne
Ranch Hand
Posts: 703
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You probably have to set the first Icon to null before reloading the new Icon file.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic