java 显示大图片

firstfhy 2008-10-21 04:40:40
我想显示一张图片,尺寸6180*4326,容量4M,JPEG格式。用普通的显示方法都报错,好像是JVM内存溢出,可是我不会解决,求教!
Exception in thread "Image Fetcher 3" java.lang.OutOfMemoryError: Java heap space
at java.awt.image.DataBufferInt.<init>(Unknown Source)
at java.awt.image.Raster.createPackedRaster(Unknown Source)
at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)
at sun.awt.image.ImageRepresentation.createBufferedImage(Unknown Source)
at sun.awt.image.ImageRepresentation.setPixels(Unknown Source)
at sun.awt.image.ImageDecoder.setPixels(Unknown Source)
at sun.awt.image.JPEGImageDecoder.sendPixels(Unknown Source)
at sun.awt.image.JPEGImageDecoder.readImage(Native Method)
at sun.awt.image.JPEGImageDecoder.produceImage(Unknown Source)
at sun.awt.image.InputStreamImageSource.doFetch(Unknown Source)
at sun.awt.image.ImageFetcher.fetchloop(Unknown Source)
at sun.awt.image.ImageFetcher.run(Unknown Source)
我是在做J2SE的开发,在JPanel里显示这个大图,其实我不是要全显示,是根据用户的操作相应的显示该图片的一部分,所以不能把尺寸缩小。但是要是可以把图片的一部分(需要显示的那部分)画在JPanel上也好啊。高手赐教!!!
不好意思,我第一次发帖,新用户还没有分数……
...全文
93 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
常遇道 2008-12-09
  • 打赏
  • 举报
回复
顶起来

62,615

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧