简体   繁体   English

如何在Intellij中轻松加载图像?

[英]How can you load images easily in Intellij?

I'm trying to load images from my project directory. 我正在尝试从项目目录加载图像。

I have images in a folder, starting at the project directory: 我在文件夹中有图像,从项目目录开始:

Project/res/textures

How might I easily access these images so I can say: 我如何轻松访问这些图像,这样我可以说:

"/textures/image.png" when loading an image? 加载图像时是"/textures/image.png"

You want textures to be in the root of your class path. 您希望textures位于类路径的根中。 An easy way to do that is to mark Project/res as a Resources Root . 一种简单的方法是将Project/res标记为Resource Root

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

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