Re: Java Applet - shared one VM problem
- From: "00_DotNetWarrior" <00_DotNetWarrior@xxxxxxxxx>
- Date: Fri, 29 Apr 2005 15:08:28 -0400
I figured out myself... stupid mistake I defined it as "static" !!!
problem solved.
"00_DotNetWarrior" <00_DotNetWarrior@xxxxxxxxx> wrote in message
news:95OdnRUmTrU_HO_fRVn-uQ@xxxxxxxxxxxxx
> 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() {
> }
> }
>
>
.
- References:
- Java Applet - shared one VM problem
- From: 00_DotNetWarrior
- Java Applet - shared one VM problem
- Prev by Date: Java Applet - shared one VM problem
- Next by Date: DLLLib class
- Previous by thread: Java Applet - shared one VM problem
- Next by thread: DLLLib class
- Index(es):