Wednesday, 15 February 2012

What is the base class for all swing components? | Java Applets

JComponent (except top-level containers)

How do you communicate in between Applets and Serviets? | Java Applets

We can use the java.net.URLConnection and java.net.URL classes to open a standard HTTP connection and “tunnel” to the web server. The server then passes this information to the serviet in the normal way. Basically, the applet pretends to be a web browser, and the serviet doesn’t know the difference. As far as the serviet is concerned, the app let is just another HTTP client.

How will you communicate between two Applets? | Java Applets

The simplest method is to use the static variables of a shared class since there’s only one instance of the class and hence only one copy of its static variables. A slightly more reliable method relies on the fact that all the applets on a given page share the same AppletContext We obtain this applet context as follows:
App letContext ac = getAppletContext;
AppletContext provides applets with methods such as getApplet(name), getApplets,getAudioCl ip, gellmage, showDocument and showStatusQ.

When is update method called? | Java Applets

Whenever a screen needs redrawing (e.g., upon creation, resizing, validating) the update method is called. By default, the update method clears the screen and then calls the paint method, which normally contains all the drawing code.

Which method is used to output a string to an applet? Which function is this method included in? | Java Applets

drawString( ) method is used to output a string to an applet. This method is included in the paint method of the Applet.

What are the steps involved in Applet deelopment? | Java Applets

Following are the steps involved in Applet development
Create/Edit a Java source file. This file must contain a class which extends Applet class. Compile your program using javac Execute the appletviewer, specifying the name of your applet’s source file or html file. in case the applet information is stored in html file then Applet can be invoked using java enabled web browser.

What are the Applets information methods? | Java Applets

The following are the Applet’s information methods:
getAppletlnfo() method: Returns a string describing the applet, its author, copyright information, etc. getParameterlnfo() method: Returns an array of string descnbing the applet’s parameters