Search code examples
javaimageswingjarembedded-resource

Swing application that uses a large amount of data


I have developed a swing application that displays images, so I have a large amount of images (more than 1500), I'm asking what is the best way to add these images to the swing project, is it just inserting the images in a specific package, or is it better to add a zip file containing the images, or ...?? Thanks in advance


Solution

  • The "right" answer here depends on what you plan to do with the images. If you're using them as icons, you might want to externalize those into a zip file or even a directory structure you ship with the app so they can be swapped out if you ever find the need. A zip file is pretty easy to access from code, and you can even organize it like a java source / package structure and drop it on the classpath so you can load the images with getClass().getResourceAsStream("whatever"). That has the advantage of not conflating actual source code with resource files like images.