What is the difference between panel and frame ?
A Panal and the Frame, both are the component of
the Abstract Window Toolkit(AWT). A panel is a
component which can be embedded in a frame, and a
frame is nothing but a window application an can
embed all the components. Frame-is a top level
while the panel is sub-level container..not the top level
What are the types of methods in mouse listeners ?
* public void mouseClicked(MouseEvent e)
* public void mouseReleased(MouseEvent e))
* public void mouseOver(MouseEvent e)
* public void mouseDoubleClicked(MouseEvent e)
* public void mousepressed(MouseEvent e)Reply
What are the types of mouse event listeners ?
What are all the listeners in java and explain ?
An event listener is an object used to handling a
particular kind of event.
Event Handling Interfaces
What is mean by event handling ?
Events represent the activity that occurs between
the user and the application. Java�s Abstract
Windowing Toolkit (AWT) communicates these
actions to the programs using events. When the
user interacts with a program, by clicking a
command button, the system creates an event
representing the action and delegates it to the
event-handling code within the program. This code
determines how to handle the event so the user
gets the appropriate response. Java provides the
Event class and each event is represented by an
object that gives information about the event and
identifies the event source. Whenever an event
occured by an event sourse, An appropriate evetnt
handler(EventListener) is called. The Event
Listener knows that how to handle the handle.
How to communicate between applet and an applet ?
Sometimes you need to allow two or more applets to
communicate on the Web page. Because the applets
all run within the same Java context-that is, they
are all in the same virtual machine together-applets
can invoke each other's methods.The AppletContext
class has some methods for locating another applet
by name, or retrieving all the applets in the current
runtime environment. The AppletContext class in the
java.applet package contains the two member functions
getApplet and getApplets. By using these functions, an
applet can find other applets and invoke methods on them.
<applet code="App1" width="400" height="100" name="applet1">
<applet code="App2" width="400" height="100" name="applet2">
Using the name attribute, you can refer to a applet:
Applet anotherApplet = getApplet("applet1");
anotherApplet.someMethod(); //calling any public method
What is the difference between getAppletInfo and getParameterInfo ?
The getAppletInfo() method returns the string that
describes the applet. The getParameterInfo() method
returns an array of string arrays that specify the
name,type, and description of each of the parameter.
What is the use of parameter tag ?
In java applets, the parameter tag is used in the
html used to send parameter to applet. In applet
you can read the parameters passed by html code.
What is mean by getCodeBase and getDocumentBase method ?
The getDocumentBase() method returns "the URL of
the document in which the Applet is embedded." It
actually return the URL of the directory in which
the document resides.
The getCodeBase() method gets the base URL. This
is the URL of the directory which contains this
the base URL of the directory which contains this
How do you load an HTML page from an Applet ?
Applets are loaded and executed within a web
browser, and hence you can load specific URL.
* Get a reference to the applet context
* Call the showDocument method with a URL
object as parameter.
The following code can help here:
public class MyApplet extends Applet
// Applet code here
// load an html page
public void showPage (String aPage)
//aPage should contained address of the HTML page to be shown
URL url = null;
url = new URL (aPage);
catch (MalformedURLException e)
if (url != null)