用这个函数
/**
* Creates a scaled version of this image.
* A new <code>Image</code> object is returned which will render
* the image at the specified <code>width</code> and
* <code>height</code> by default. The new <code>Image</code> object
* may be loaded asynchronously even if the original source image
* has already been loaded completely. If either the <code>width</code>
* or <code>height</code> is a negative number then a value is
* substituted to maintain the aspect ratio of the original image
* dimensions.
* @param width the width to which to scale the image.
* @param height the height to which to scale the image.
* @param hints flags to indicate the type of algorithm to use
* for image resampling.
* @return a scaled version of the image.
* @see java.awt.Image#SCALE_DEFAULT
* @see java.awt.Image#SCALE_FAST
* @see java.awt.Image#SCALE_SMOOTH
* @see java.awt.Image#SCALE_REPLICATE
* @see java.awt.Image#SCALE_AREA_AVERAGING
* @since JDK1.1
*/
public Image getScaledInstance(int width, int height, int hints)
/**
* Creates a scaled version of this image.
* A new <code>Image</code> object is returned which will render
* the image at the specified <code>width</code> and
* <code>height</code> by default. The new <code>Image</code> object
* may be loaded asynchronously even if the original source image
* has already been loaded completely. If either the <code>width</code>
* or <code>height</code> is a negative number then a value is
* substituted to maintain the aspect ratio of the original image
* dimensions.
* @param width the width to which to scale the image.
* @param height the height to which to scale the image.
* @param hints flags to indicate the type of algorithm to use
* for image resampling.
* @return a scaled version of the image.
* @see java.awt.Image#SCALE_DEFAULT
* @see java.awt.Image#SCALE_FAST
* @see java.awt.Image#SCALE_SMOOTH
* @see java.awt.Image#SCALE_REPLICATE
* @see java.awt.Image#SCALE_AREA_AVERAGING
* @since JDK1.1
*/
public Image getScaledInstance(int width, int height, int hints)
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货