有一个问题,就是我写了一个applet访问本地打印机的例子,用appletview执行的时候可以打印并且一切正常,可是在IE中执行的时候先是弹出一个对话框说要打印,是否允许?,我点了是之后却打印不出内容,这是为啥啊?是不是applet不可以使用本地打印机啊?如果想要在IE中运行需要怎么做呢?
---------------------------------------------------
applet的start()
--------------------------------------------------
  public void start() {
    PrintService service = PrintServiceLookup.lookupDefaultPrintService();
    //设置打印属性
    PrintRequestAttributeSet attrs = new HashPrintRequestAttributeSet();
    //弹出打印预览窗口
    try {
      url = new URL("http://www.google.com/intl/zh-CN_ALL/images/logo.gif");
    }
    catch (Exception er) {
    }
    //设置文档类型
    DocFlavor flavor = DocFlavor.URL.GIF;
    Doc doc = new SimpleDoc(url, flavor, null);
    //创建作业
    DocPrintJob job = service.createPrintJob();
    //设置打印页数
    attrs.add(new Copies(1));
   // attrs.add(MediaSizeName.ISO_A4);    try {
      System.out.println("开始打印!");
      job.print(doc, attrs); //打印
      System.out.println("打印结束!");
    }
    catch (PrintException ex2) {
      ex2.printStackTrace();
    }
  }
---------------------------------------------------
html
--------------------------------------------------
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>
HTML Test Page
</title>
</head>
<body>
<applet
  codebase = "."
  code     = "Applet1.class"
  name     = "TestApplet"
  width    = "400"
  height   = "300"
  hspace   = "0"
  vspace   = "0"
  align    = "middle"
>
</applet>
</body>
</html>