Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: Applet to Applet Communication

Applet to Applet Communication

Tutorial Details:

Java Tip 3: Our first Java Tip winner!
Java Tip 3: Our first Java Tip winner!
By: By John D. Mitchell
How two applets on different Web pages communicate
his week we present our first Java Tip of the Week Contest Winner! Our Java Tip this week comes to us from Greg Williams.
Greg has put together some code to show us one way for two applets on two separate pages to communicate with each other.
The Ticket Frames page will launch the demonstration. Two frames will be displayed with each frame displaying a different HTML page. The Ticket Holder page will display in the top frame while the Ticket Reader page displays in the bottom frame. Note that you will need Netscape Navigator 2.x or some other browser that supports HTML frames to view this demonstration.
Those two simple pages are just HTML wrappers for running the TicketHolder and TicketReader Java applets, respectively. Both applets make use of the Ticket abstract Java class.
The two applets are straightforward examples of multithreaded Java applications. The pair of them implement a classic reader/writer scenario. The TicketHolder class is periodically updating the shared data while the TicketReader class is periodically reading the shared data.
The "shared data" is encapsulated in the Ticket class as a "static" data member manipulated by the synchronized, static accessor and mutator class methods. So each applet is just using the Ticket class as a third party to facilitate communication. This method will scale up to handle more readers (but multiple writers offer lots of fun new problems).
This page formated for crawlers and browsers that don't support scripts and tables.
Home
EZone


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
Applet to Applet Communication

View Tutorial:
Applet to Applet Communication

Related Tutorials:

Java Q&A - Java Still Open
Java Q&A - Java Still Open
 
Java Q&A, Open Java?
Java Q&A, Open Java?
 
Saving and retrieving objects with Java
Saving and retrieving objects with Java
 
JavaWorld - Distributed applet-based massively parallel processing (DAMPP) - January 1997
JavaWorld - Distributed applet-based massively parallel processing (DAMPP) - January 1997
 
Reloading Applets
Reloading Applets
 
Applet to Applet Communication
Applet to Applet Communication
 
How to write a Java Card applet: A developer's guide
How to write a Java Card applet: A developer's guide
 
Tip 80: Resize applets within browser frames - JavaWorld
Tip 80: Resize applets within browser frames - JavaWorld
 
JDK 1.2 breaks the Java sound barrier - JavaWorld August 2000
JDK 1.2 breaks the Java sound barrier - JavaWorld August 2000
 
Alternative deployment methods, Part 2: The best of both worlds - JavaWorld July 2000
Alternative deployment methods, Part 2: The best of both worlds - JavaWorld July 2000
 
Alternative deployment methods, Part 3: The code - JavaWorld September 2000
Alternative deployment methods, Part 3: The code - JavaWorld September 2000
 
Java security evolution and concepts, Part 3: Applet security - JavaWorld December 2000
Java security evolution and concepts, Part 3: Applet security - JavaWorld December 2000
 
Java security evolution and concepts, Part 5
Java security evolution and concepts, Part 5
 
Enhance your J2EE presentation layer
Enhance your J2EE presentation layer
 
OpenSign
OpenSign OpenSign is a java applet for signing text in a webbrowser using a PKCS-12 key-files or keys located in MS Crypto API CSP's in a Win32 environment. The applet is based on code kindly provided by IT-Practice and everyone is encouraged to subm
 
JSyntaxColor 1.2.7
JSyntaxColor 1.2.7 JSyntaxColor is a library for coloring in real time user text input.
 
JLog
JLog is an implementation of a Prolog interpreter, written in Java. It\'s primary benefit is that can be run on almost any platform supporting Java (such as a web browser), and as such it is well suited for educational purposes.
 
Accessing Databases Using Java and JDBC
This article will show how a Java Application, Applet or Servlet can access data stored in relational databases using the JDBC API.
 
Digital Clock developed in java
This digital clock displays the local time in 24-hour format. Hours, minutes and seconds are displayed as 7-segment BCD-LED digits with segments tapered at both ends.
 
Java RMI Tutorial
This is a brief introduction to Java Remote Method Invocation (RMI). Java RMI is a mechanism that allows one to invoke a method on an object that exists in another address space.The other address space could be on the same machine or a different one. The
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.