// Program 12.6 Magnify Image import java.awt.Graphics; import java.applet.Applet; import java.awt.Image; public class MagnifyImage extends Applet { Image theImage; int scalefactor; int scaleWidth, scaleHeight; public void init() { String filename=getParameter("imagefile"); theImage = getImage(getDocumentBase(), filename); scalefactor = Integer.valueOf(getParameter( "scalefactor" )).intValue(); } public void paint (Graphics g) { int x = theImage.getWidth(this); int y = theImage.getHeight(this); scaleWidth = x * scalefactor; scaleHeight = y * scalefactor; g.drawImage(theImage, 0, 0, scaleWidth, scaleHeight, this); } }