Sunday 25 March 2012

Other Methods in Applets

•update() – This method is available in the “Component” class which is available in “java.awt” package. This method is used to update a specific region or a part of the applet.

•repaint() – This method is used to self update the applet’s display area. repaint() implicitly invokes the update() method. repaint() is also declared in the “Component” class.

•getDocumentBase() – This method returns the location of the applet file (.class file). The return type of this method is the predefined class “URL”.

•getCodeBase() – This method returns the directory path in which the applet file (.class file) is present. The return type of this method is “URL”.


•showDocument() – This method is declared in the “AppletContext” interface which is available in “java.applet” package.

AppletContext allows you to gather information from the applet’s environment.

Using the showDocument() method we can view other types of files in the browser.

There are two versions of this method as shown below:
1) void showDocument(URL url)
2) void showDocument(URL url, String location)
The valid values for the “location” parameter are “_self”, “_parent”, “_top” and “_blank”.

No comments:

Post a Comment