• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Refreshing of ImageIcon/JLabel

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone. I need your help in clarifying some of my doubts, hope you can help me out.

I've created a java program which download images from the server. After the download is complete, the program will create another UI displaying the downloaded images.
I'm able to repeat the downloading process, each time downloading different images.
The images is displayed correctly on the first attempt. However, on the subsequent download, the image displayed on the UI wasn't refreshed although the image in the system has changed.

My question is :
1) Can I set/refresh the same ImageIcon which I've created/used earlier?
e.g
Label[1].setIcon(MovieImage[1]);

Thanks in advance
 
Author
Posts: 986
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Changing the JLabel's icon with setIcon() should work fine. If it's not working for you, then I guess we need more information.
 
Adrian Lee
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Brian. I'm trying to reuse the ImageIcons that I've created previously. Somehow the whole thing don't work for me. Even though the images has been overwrite, my UI program still displays the old images.

Can the ImageIcons be reused?

Thanks for your reply.
 
Brian Cole
Author
Posts: 986
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Adrian Lee:
I'm trying to reuse the ImageIcons that I've created previously. Somehow the whole thing don't work for me. Even though the images has been overwrite, my UI program still displays the old images.

Can the ImageIcons be reused?



I'm not sure what you mean by "the images has been overwrite" but, yes, you may reuse an ImageIcon. You may even use an ImageIcon several times simultaneously.

If you're having some problems, perhaps you should show us some code.
 
Adrian Lee
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Brian and thanks for clearing my doubt on ImageIcon. My code is rather long, so I'll just post some of it here.

Basically, I'll call a socket program to do a download of images whenever I require. Everything is running smootthly except for the ImageIcon refresh part.


I'm still trying to figure out why my ImageIcon on the label can't be refreshed.
[ April 28, 2008: Message edited by: Adrian Lee ]
 
Adrian Lee
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've found another method to go through this. Thanks for your help.

 
Tell me how it all turns out. Here is a tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic