我把printMap()解释一下public void printMap() {
    //String filename = TMP_FILE;
    //获取HTML中的APPLET中的param
    String filename = getParameter("Filepath"); //获取HTML文件中的URL路径
    //////
    String str;
     //构建打印请求属性集
    PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
    //设置打印格式,
    DocFlavor flavor = DocFlavor.INPUT_STREAM.JPEG;
    //查找所有的可用打印服务
    PrintService printService[] = PrintServiceLookup.lookupPrintServices(flavor,
        pras);
    //定位默认的打印服务
    PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService();
    //显示打印对话框
    PrintService service = ServiceUI.printDialog(null, 200, 200, printService,
                                                 defaultService, flavor, pras);
    if (service != null) {
      try {        DocPrintJob job = service.createPrintJob();//创建打印作业
        FileInputStream fis = new FileInputStream(filename);//构造待打印的文件流
        DocAttributeSet das = new HashDocAttributeSet();        Doc doc = new SimpleDoc(fis, flavor, das);//建立打印文件格式
        // PageFormat format = job.pageDialog(attributes);
        job.print(doc, pras);//进行文件的打印
      }
      catch (Exception e) {
        e.printStackTrace();
      }    }
  }  //
  public void paint(Graphics g) {
    //Draw a Rectangle around the applet's display area.
    g.drawRect(0, 0, size().width - 1, size().height - 1);    //Draw the current string inside the rectangle.
    //g.drawString("buffer.toString()", 5, 15);  }}