Image 加载图像
来源:互联网 发布:专业手机视频数据恢复 编辑:程序博客网 时间:2024/04/29 21:19
此处需要注意的是图像文件的路径。
项目的文件目录如下:
HelloJAVAME/
.......... src/
...........res/
在此目录的组织下,图片处于资源目录RES下,所以加载图片时用绝对路径的情况下是“/zhaoyun.png”,此处一定要加斜杠。
类似的情况,如果res下面有多个目录, 如 res/beauty/zhaoyun.png,则加载路径为”/beauty/zhaoyun.png“
----------------------摘录一段document
Application Resource Files
Application resource files are accessed usinggetResourceAsStream(String name)
injava.lang.Class
. In the MIDP specification,getResourceAsStream
is used to allow resource files tobe retrieved from the MIDlet Suite's JAR file.
Resource names refer to the contents of the MIDlet Suite JARfile. Absolute pathnames, beginning with "/" are fully qualifiedfile names within the jar file.
Relative pathnames, not beginning with "/" are relative to theclass upon which getResourceAsStream
is called.Relative names are converted to absolute by prepending a "/"followed by the fully qualified package with "." charactersconverted to "/" and a separator of "/". The resulting string isreduced to canonical form by applying as many times as possible thefollowing:
- All occurences of "/./" are replaced with "/".
- All occurences of "/segment/../" are replaced with "/" wheresegment does not contain "/".
The canonical resource name is the absolute pathname of theresource within the JAR.
In no case can the path extend outside the JAR file, andresources outside the JAR file MUST NOT be accessible. For example,using "../../" does NOT point outside the JAR file. If there areany remaining "." or ".." characters they are treated literally inlocating the resource. No resource can exist with that name sonull
is returned fromClass.getResourceAsStream
. Also, devices MUST NOTallow classfiles to be read from the JAR file as resources, but allother files MUST be accessible.
- Image 加载图像
- 图像分割(Image Segmentatio…
- ios 从URL加载图像
- Loading an Image:加载一幅图像
- Flex Image加载Servlet图像流处理
- Flex Image加载Servlet图像流处理
- javascript dom中的Image对象——图像预加载
- Android 图像异步加载之Android-Universal-Image-Loader
- Image Load Events——图像加载事件
- QNX下LVDS调试和加载image图像
- Image 加载
- UITableView Background Image
- zoj 1047 Image Perimeters
- image matting
- Loading and Painting an Image in an Applet:在Applet中加载并绘制图像
- 在WPF中使用Emgu加载Image<,>图像的两种方法
- Emgu OpenFileDialog()打开图像,分别用Image和Mat CvInvoke.Imread 加载
- 图像相关(一) WPF Image控件动态加载图片方式
- Notepad++ 免费的超强编译器
- java的几种对象(PO,VO,DAO,BO,POJO…
- 北京欢迎您, 放飞歌声
- Eclispe 插件的安装
- run Windows Mobile connecting in…
- Image 加载图像
- 如果赌博拒收美元 <转>
- firefox的flash插件
- mandriva2009硬盘安装
- 牯岭街少年杀人事件
- 游戏手柄设置
- PDU and TPDU
- How to got the Mac address from …
- 终于舒了一口气