实现图片的放大,缩小,与还原。

异常处理源码:
try {
mt.waitForAll();
} catch (Exception ex)
{
ex.printStackTrace();
扫描图像文件
public boolean accept(File file)
{String name = file.getName().toLowerCase(); //获取文件名
Return name.endsWith(".gif")|| name.endsWith(".jpg")|| name.endsWith(".jpeg")|| file.isDirectory();}
放大与缩小
放大图像:if(button==jbZoomIn)
showImagePane.scaleX *= 1.25; //图像x轴方向放大图片
showImagePane.scaleY *= 1.25; //图像y轴方向放大图片

缩小图像:if(button==jbZoomOut)
showImagePane.scaleX *= 0.8; //图像x轴方向缩小图片
showImagePane.scaleY *= 0.8; //图像y轴方向缩小图片

还原图像:if(button==jbReset)
showImagePane.scaleX = 1.0; //图像x轴方向放大图片还原为1.0
showImagePane.scaleY = 1.0; //图像y轴方向放大图片还原为1.0
本程序用到了事件响应:
用行结果:
图片放大

图片的缩小:

原图:

posted on 2016-03-18 22:51  14软件G1班进晓宇  阅读(296)  评论(3编辑  收藏  举报