Example usage for java.applet AppletContext showDocument

List of usage examples for java.applet AppletContext showDocument

Introduction

In this page you can find the example usage for java.applet AppletContext showDocument.

Prototype

public void showDocument(URL url, String target);

Source Link

Document

Requests that the browser or applet viewer show the Web page indicated by the url argument.

Usage

From source file:MainClass.java

public void paint(Graphics g) {
    AppletContext ac = getAppletContext();
    try {/*from   w  w  w . j  av a  2s.  c  o m*/
        URL url = new URL("http://www.java2s.com");
        ac.showDocument(url, "frame2");
    } catch (Exception e) {
        showStatus("Exception: " + e);
    }
    g.drawString("ShowDocument Applet", 10, 25);
}

From source file:org.openehealth.coms.cc.consent_applet.applet.ConsentApplet.java

/**
 * Opens a new window and shows the current consent as a PDF within
 * //from   www  .jav  a  2 s .  c om
 */
private void requestConsentPDF() {

    try {
        AppletContext a = getAppletContext();
        URL url = new URL(
                strRelURL + "/" + privilegedServlet + "CreateConsentServiceServlet?type=newconsentpdf");
        a.showDocument(url, "_blank");
    } catch (MalformedURLException e) {
        System.out.println(e.getMessage());
    }
}