21⟩ What is AppletStub Interface?
The applet stub interface provides the means by which an applet and the browser communicate. Your code will not typically implement this interface.
“Java Applet Programming Interview Questions and Answers will guide us now that a Java applet is an applet delivered to the users in the form of Java bytecode. Java applets can run in a Web browser using a Java Virtual Machine (JVM), or in Sun's AppletViewer, a stand-alone tool for testing applets. Learn Java Applet Programming or get preparation of Java Applet by the help of this Java Applet Programming Interview Questions with Answers guide”
The applet stub interface provides the means by which an applet and the browser communicate. Your code will not typically implement this interface.
Use the getSize() method, which the Applet class inherits from the Component class in the Java.awt package. The getSize() method returns the size of the applet as a Dimension object, from which you extract separate width, height fields. The following code snippet explains this:
Dimension dim = getSize();
int appletwidth = dim.width();
int appletheight = dim.height();
Name your applets inside the Applet tag and invoke AppletContext’s getApplet() method in your applet code to obtain references to the
other applets on the page.
Ask the applet for its applet context and invoke showDocument() on that context object.
URL targetURL;
String URLString
AppletContext context = getAppletContext();
try
{
targetURL = new URL(URLString);
}
catch (MalformedURLException e)
{
// Code for recover from the exception
}
context. showDocument (targetURL);
The Canvas class of java.awt is used to provide custom drawing and event handling. It provides a general GUI component for drawing images and text on the screen. It does not support any drawing methods of its own, but provides access to a Graphics object through its paint() method. The paint() method is invoked upon the creation and update of a canvas so that the Graphics object associated with a Canvas object can be updated.
Java v1.02 only supports the "voice format" of the .au sound files. This is also know as "µ-law, 8/16-bit, mono, 8000hz sample rate"