Hey, if you're going to *answer*, please give an answer and specifics.  'check
out the Java web site' is not really good enough - you might as well not say
anything.

More particularly, look at:

http://java.sun.com/products/jdk/1.2/docs/api/java/applet/AppletContext.html#getApplet(java.lang.String)
, and
http://java.sun.com/products/jdk/1.2/docs/api/java/applet/Applet.html#getAppletContext()

Assuming all your applets are in the same HTML page, and you have used the
name="somename" attribute inside your <APPLET> tags, then you can get at any
Applet on your page by calling

   // get the applet context
   AppletContext myContext = thisApplet.getAppletContext();

   // get the applet itself from the context
   Applet other = myContext.getApplet("somename");

   // cast the applet to it's subclass ... make sure you know it is an
ExtendedApplet though!
   // you must do this in order to do anything useful with your other applet once
you have it
   ExtendedApplet extended = (ExtendedApplet) other;

   // call a method on your other applet
   extended.myMethod();


Now, if your applets are not all on the same page, then you can still *open them*
without losing your current applet by using:

   myContext.showDocument(new
URL("http://myserver/applets/otherAppletPage.html"), "new_window");

This will load up the Applets on that page, in a new browser window, *but* they
will be in their own AppletContext, so you won't be able to do inter-applet
communication between applets on different HTML pages without an intermediary.

If you really, really need inter-applet communication between applets not on the
same page, I have an idea (involving RMI) how to do it, but won't go on about it
here.

Regards,
David.


Paresh Gheewala wrote:

> Hi,
>
> Create the instance of it and make it available into current directory or in
> package.
> I think in Applet context you can call another Applet.
> plz. check out Java APIs on
>
> http://www.java.sun.com
> Search for "Calling Applet"
>
> I think this will help you out.
> Paresh
>
> Moloy Biswas wrote:
>
> > Can anyone tell me how to call one applet from another applet ? This is
> > required to me because I want to design a system of multiple hiererchy
> > of applets and with those applets I want to handle a backend database.
> > In the front end I want to use a browser to get the parent applet.
> >
> > Please help, this is very very urgent for me.
> >
> > Thanks in advance
> >
> > Moloy
> >
> > --------------------------------------------------------------
> > SREI INTERNATIONAL FINANCE LTD., CALCUTTA, INDIA
> >
> > ___________________________________________________________________________
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > Resources: http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

--
David Bullock
Project Manager - Strategic Applications
[EMAIL PROTECTED]

"It's no use saying 'We are doing our best.'  You
have got to succeed in doing what's necessary."
    ...Winston Churchill


LISAcorp
http://www.lisa.com.au/

Adelaide                  Sydney
--------------------      ------------------------
38 Greenhill Rd           Level 3, 228 Pitt Street
Wayville S.A. 5034        Sydney NSW 2000

PH  +61 8 8272 1555       PH  +61 2 9283 0877
FAX +61 8 8271 1199       FAX +61 2 9283 0866
--------------------      ------------------------

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to