imageapplet.java

来自「程序练习中包括书中实例程序代码和练习中要用到的代码,是压缩文件」· Java 代码 · 共 32 行

JAVA
32
字号
package examples.awt;

import java.awt.*;
import java.applet.Applet;

/** An example applet that loads and displays an image
  */
public class ImageApplet extends Applet {

   private Image image;

   public void init() {
      image = getImage( getDocumentBase(),
                        getParameter( "image" ) );
   }

   public void paint( Graphics g ) {
      g.drawImage( image , 0, 0, this );
   }

   public String getAppletInfo() {
      return "Demonstration applet";
   }

   public String[][] getParameterInfo() {
      String pInfo[][] = {
         { "image", "String",
           "The file containing the image."  }
      };
      return pInfo;
   }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?