Have Applets on different frames communicates with each otherTag(s): Javascript interaction
You can use a Javascript function as a bridge between the 2 frames.
[main HTML (interframe0.html)]
<HTML><HEAD></HEAD> <FRAMESET COLS="50%,*"> <FRAME SRC="interframe1.html" NAME="f1" > <FRAME SRC="interframe2.html" NAME="f2"> </FRAMESET> </HEAD>
[frame 1 HTML (interframe1.html)]
<HTML><HEAD></HEAD> <SCRIPT> function toOtherFrame(a, target) { if (target == "f1") parent.f1.document.app1.fromOtherFrame(a); else parent.f2.document.app2.fromOtherFrame(a); } </SCRIPT> </HEAD> <BODY> <APPLET CODE="InterFrameDemo.class" NAME="app1" MAYSCRIPT HEIGHT=200 WIDTH=200> <PARAM NAME="target" VALUE="f2"> </APPLET></BODY></HTML>
[frame 2 HTML (interframe2.html)]
<HTML><HEAD></HEAD> <BODY> <APPLET CODE="InterFrameDemo.class" NAME="app2" MAYSCRIPT HEIGHT=200 WIDTH=200> WIDTH=200> <PARAM NAME="target" VALUE="f1"> </APPLET></BODY></HTML>
[Java applet (InterFrameDemo.java)]
import java.applet.*; import java.awt.*; import java.awt.event.*; import java.net.URL; import netscape.javascript.*; public class InterFrameDemo extends Applet implements ActionListener { TextField tf; Button b; String target; public void init() { target = getParameter("target"); setLayout(new BorderLayout()); tf = new TextField(20); add("South", tf); b = new Button("To other frame"); add("North",b); b.addActionListener(this); } public void actionPerformed(ActionEvent ae) { if (ae.getSource() == b) { String js = "parent.f1.toOtherFrame(\"" + tf.getText() + "\",\"" + target + "\")"; System.out.println("to Javascript:" + js); JSObject win = (JSObject) JSObject.getWindow(this); win.eval(js); } } public void fromOtherFrame(String s) { tf.setText(s); } }
Try it here
For a JAVA-only solution check this Java How-to