Пример #1
0
  void insertButton(Document document, PrintWriter out) {
    String fileName = "netnow3.gif";
    String imgURLString =
        "http://home.netscape.com/comprod/products/navigator/version_3.0/images/" + fileName;

    writeImageToDisk(document, imgURLString, fileName);

    try {
      // Write the HTML for the button
      Tag anchor = new Tag("A");
      anchor.addAttribute("HREF", "http://www.netscape.com");
      Tag anchorEnd = new Tag("A", false);
      Tag img = new Tag("IMG");
      URL imgURL = new URL(document.getWorkDirectoryURL(), fileName);
      img.addAttribute("SRC", imgURL.toString());
      out.print(anchor);
      out.print(img);
      out.print(anchorEnd);
    } catch (Throwable t) {
      t.printStackTrace();
    }
  }