程序如下“import java.applet.*;
import java.awt.*;
import javax.swing.*;
public class ImageScale extends JApplet
{
 private Image narrow;
 private ImageIcon narrow2;
 private int w,h,jw,ih;
 public void init()
 {
 narrow=getImage(getDocumentBase(),"b.gif");
 narrow2=new ImageIcon("b.gif");
 w=getWidth();
 h=getHeight();
 iw=narrow2.getIconWidth();
 ih=narrow2.getIconHeight();
  }
public void paint(Graphics g)
{
 narrow2.paintIcon (this,g,(w-iw)/2,0);
 g.drawImage (narrow,0,ih+10,w,h-(ih+10),this);
 showStatus("\t\tdadsd");
}}