Share this page 

Have Applets on different frames communicates with each other (this howto is deprecated)Tag(s): DEPRECATED

It is possible to share data between different applets via static variables

[HTML (java-0023.html)]
    <FRAME SRC="java-0023-f1.html" NAME="f1">
    <FRAME SRC="java-0023-f2.html" NAME="f2">
[HTML (java-0023-f1.html AND java-0023-f2.html)]
<APPLET CODE="Java0023.class"
[JAVA source (]
import java.awt.*;
import java.applet.*;

public class Java0023 extends Applet {
  TextField tf;
  Button    a,b;

  public void init() {
    setLayout(new FlowLayout());
    a  = new Button("Send to Message");
    b  = new Button("Receive from Message");
    tf = new TextField(20);

  // JDK 1.02 style evant handling
  public boolean action(Event e, Object o) {
    if ( instanceof Button) {
       if ( == a) {
          StaticMessage.message = tf.getText();
       if ( == b) {
       return true;
    return false;

class StaticMessage {
  public static String message = "";

Try it here.

Check this DDJ article for a more elaborate way to implement this principle.

There is one way to do it by using a Javascript function as a bridge, take a look at this How-to.