Java Applet - shared one VM problem



I have a very simple Java Applet (see below), when I launched 2 browsers
(say 2 Netscapes or firefox, with latest Sun Java VM 1.5.0), pointing to the
same Java Applet. They shared the SAME Java VM!!!! When clicking on the
start button, the text is printing to the wrong browser!!! Help... because
my application is allowed to have multiple instances access from the same
desktop. Please help........


import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
import javax.swing.*;
import java.sql.*;
import java.util.*;
import java.net.*;
import java.lang.*;
import java.io.*;

public class Share extends Applet implements Runnable, ActionListener {

private static TextArea my_message_area;
private Button my_button;
public Share() {
}

public void actionPerformed(ActionEvent e) {
String arg = e.getActionCommand();

if ("start".equals(arg)) {
print_me();
}

}

public String getAppletInfo() {
return "test";
}

private void print_me() {
my_message_area.append("\ntesting");
}

public void init() {
my_button = new Button("start");
my_message_area= new TextArea("", 9, 40);
my_message_area.setEditable(false);
setLayout(new BorderLayout());
my_button.addActionListener(this);
add("North", my_message_area);
add("South", my_button);

}

public void start() {
}
public void stop() {
}
public void run() {
}
}


.


Quantcast