This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Java Applets,Threads

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. How do you communicate between 2 applets?
2. Implementing a runnable interface/extending a thread class. which is better?
Thanks in advance
Regards
Prathiba
 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


1. How do you communicate between 2 applets?


The AppletContext class in the java.applet package contains the two member functions getApplet and getApplets. By using those functions, an applet can find other applets and invoke methods on them. That can only be done if the following security requirements are met:
i)The applets originate from the same server and from the same directory on the server.
ii)The applets are running on the same page and in the same browser window.

Originally posted by Prathiba krishnamurthy:

2. Implementing a runnable interface/extending a thread class. which is better?


When your class which should run in seperate thread needs to extend another class, go for runnable.Otherwise any approach is fine.
Before going for extending Thread, make sure that the class need not extend any class in future.
[ September 17, 2003: Message edited by: Murthy Narasimha ]
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
by default an applet extends Applet class. so anyway MUST use Implements...
 
moose poop looks like football shaped elk poop. About the size of this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic