Wednesday, 15 February 2012

What tags are mandatory when creating HTML to display an applet? | Java Applets

Display an Applet Code, Height, Width Tags are mandatory.

What is AppletStub Interface? | Java Applets

The applet stub interface provides the means by which an applet and the browser communicate. Your code will not typically implement this interface.

Which classes and interfaces does Applet class consist? | Java Applets

Applet class consists of a single class, the Applet class and three interfaces:
AppletContext, AppletStub, and AudioC’lip.

Can applets on different pages communicate with each other? | Java Applets

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. heights();

How do I select a URL from my Applet and send the browser to that page? | Java Applets

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);

How can I arrange for different applets on a web page to communicate with each other? | Java Applets

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.

How do we read number information from my applets parameters, given that Applets getParameter() method returns a string? | Java Applets

Use the parselnt() method in the Integer Class, the Float(String) constructor or parseFloat() method in the Class Float, or the Double(Strrng) constructor or parseDoulbl() method m the class Double.