|
|
Applet,AWT,Swing
Interview Questions - Part2
1)How
can you push data from an Applet to Servlet ?
By using the java.net packages to create a direct network connection; or by
invoking a remote method using Java's remote method invocation (RMI) interface
or by using CORBA.
2)Where the CardLayout is used ?
CardLayout manages two or more components that share the same display space.
It lets you use one container (usually a panel) to display one out of many
possible component children (like flipping cards on a table). A program can use
this layout to show a different child component to different users. For example,
the interface shown to an administrator might have additional functionality from
the interface shown to a regular user. With card layout, our program can show
the appropriate interface depending on the type of user using the program.
Another typical use of card layout would be to let end user toggle among
different displays and choose the one they prefer. In this case, the program
must provide a GUI for the user to make the selection.
3)Difference
between Application and Applet
The difference between an application and an applet, is that an applet
is used in a browser, and an application, in a stand alone mode. A Java applet
is made up of at least one public class that has to be subclassed from
java.awt.Applet. The applet is confined to living in the user's Web browser, and
the browser's security rules, (or Sun's appletviewer, which has fewer
restrictions).
In an application, if you want to
"show" something, you have to declare one or more panel, and add your stuff in
it. In an applet, you only add your stuff directly into your applet. (Well,
because an applet is just a kind of panel 8). A Java application is made up of a
main() method declared as public static void that accepts a string array
argument, along with any other classes that main() calls. It lives in the
environment that the host OS provides.
4)Name
the containers which uses Border Layout as their default layout?
Containers which uses Border Layout as their default are: window, Frame
and Dialog classes.
|
|