File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Game Development and the fly likes Changing icon images at runtime Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Game Development
Reply Bookmark "Changing icon images at runtime" Watch "Changing icon images at runtime" New topic
Author

Changing icon images at runtime

Marc Beck
Ranch Hand

Joined: Sep 09, 2006
Posts: 36
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

Joined: Sep 25, 2006
Posts: 38
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...
 
 
subject: Changing icon images at runtime
 
Threads others viewed
JOptionPane
Insert an image into Java program
Adding a background image
Image inside jar file
Problems loading images from application JAR
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com