aspose file tools*
The moose likes Beginning Java and the fly likes how to load a directory of images to an applet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to load a directory of images to an applet?" Watch "how to load a directory of images to an applet?" New topic
Author

how to load a directory of images to an applet?

Khair Bahir
Greenhorn

Joined: Aug 01, 2011
Posts: 14
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

Joined: Oct 13, 2005
Posts: 38780
    
  23
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to load a directory of images to an applet?