Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Changing icon images at runtime

 
Marc Beck
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I give an Icon an URL at runtime. I know that with

I can give the icon an URL when I create it. But at the beginning of the program it does not know which image it should use. I want to create an empty icon and give it an URL later when the program has determined which Image to use. I tried setImage() and that did not work, because I have to give it a string as parameter(the URL of the image to use).
 
Mike Cole
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cant you use a fully transparent .gif image as the first image?
You could even store that as a byte array in an interface that way you will allways have that picture.

I never used ImageIcon so this is a shot into the blue...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!