Jump to content
  • Advertisement
Sign in to follow this  

Java Question: How to refer to an Icon using concatenated Strings?

This topic is 2743 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Here is my problem. I have created many different icon objects, each named with this general format:


For example, billdown5icon, steveright2icon, etc.

I want to repeatedly change a JLabel's icon to accomplish a simple animation

So I am trying:


But Java is expecting an Icon as the argument, and here I'm giving it a string. I don't want to give it a String, I want to say "use the icon which has this particular name"

Is there an easy way to do this?

Thanks in advance.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!