Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to load a directory of images to an applet?

 
Khair Bahir
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys,

This is a snippet of how I'd normally load images (where the images are cards) from the directory "images":



What if I had 52 cards? Is there a better way than to write out every statement?
 
Campbell Ritchie
Sheriff
Pie
Posts: 48967
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If they have names with consecutive numbers, you can run a loop and add the numbers to the strings.

getImage(getDocumentBase(), "image" + i + ".gif");

That depends on the images being named consecutively.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic