【发布时间】:2013-04-16 17:10:41
【问题描述】:
我正在使用它来设置缓冲图像的大小。
Dimension imgDim = new Dimension(700, 380);
BufferedImage gridImage = new BufferedImage(imgDim.width, imgDim.height,
BufferedImage.TYPE_INT_RGB);
而不是这个,我想使用类似的东西来设置图像的大小:
Dimension imgDim = d;
BufferedImage gridImage = new BufferedImage(d.width/8, d.height/8,
BufferedImage.TYPE_INT_RGB);
但我收到了negativeArraySizeException
d 是我使用getMaximumSize() 方法得到的JFrame 的尺寸
当我打印出d.width/8 的值时,它类似于我无法理解的 268435455。有没有其他方法可以帮助解决
谢谢
【问题讨论】:
-
“动态”这个词的使用让我想知道您是否希望图像在帧被 保持 1/8th of the frame is 调整大小。你呢?
标签: java swing dynamic jframe bufferedimage