Link to home
Start Free TrialLog in
Avatar of neta
neta

asked on

Need example of getAppletContext with AWT applet !!

Can anyone please post a simple code
which will explain to me
how sohuld i use the getAppletContext
interface.
Regards
Neta :}

ASKER CERTIFIED SOLUTION
Avatar of vladi21
vladi21

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of setiawan
setiawan

I posted as a comment, because vladi21 is very quick :)

neta,
An applet runs inside a browers such as Netscape, IE or appletviewer. An applet can ask the browser to do things for it, for example to fetcht an audio clip, show a short messages in the status line, show a different web page and etc. If you use applet viewer for certain task above, it won't work.
To communicate with the browsers, an applet call the getAppletContext mehtod. The method returns an object of type AppletContext.

for example :
to show different webpage
 URL u = new URL ("http://binus.ac.id");
 getAppletContext().showDocument(u);

hope this helps

  danny
Hi neta,

  Above both comments are fine. Thye explained to show a document. I am explaining Applet-Applet communication.

 getAppletContext() will be useful for getting applet-applet communication which are resinding on same web page.

 AppletContext ac = getAppletContext();
 ac.getApplet("anotherappletname"); returns a applet for which the "anotherappletname" string is given by browser.

In that case you have to chage  applet tag as follows

<Applet code="somex.class" height=200 width=200 name="somename"></applet>

for each applet which is residing on same web page, give a  name and you can use that name in appletcontext's getApplet()
method



 after this you can call methods of someotherapplets.

Best of luck
Avatar of neta

ASKER

Thank you all

you have help me alot

keep on the good job

regards
Neta :}