Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

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...
 
Liar, liar, pants on fire! refreshing plug:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic