简体   繁体   English

使用大量数据的Swing应用程序

[英]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 ...?? 我已经开发了一个显示图像的swing应用程序,所以我有大量图像(超过1500张),我想问一下将这些图像添加到swing项目的最佳方法是将图像插入到一个特定的软件包,还是最好添加包含图像的zip文件,或者... ?? Thanks in advance 提前致谢

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. 如果您将它们用作图标,则可能需要将其外部化为应用程序附带的zip文件甚至目录结构,以便在需要时可以将其换出。 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") . 一个zip文件很容易从代码中访问,您甚至可以像java源代码/包结构一样组织它并将其放在类路径上,以便可以使用getClass().getResourceAsStream("whatever")加载图像。 That has the advantage of not conflating actual source code with resource files like images. 这样做的好处是不会将实际的源代码与资源文件(如图像)混淆。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM