Link to home
Start Free TrialLog in
Avatar of fab1970
fab1970

asked on

Two classes: one read datas from the other: how to?

I have web page with frames.
in the "main" frame i have an applet that open a socket with the server and load a whole of datas, storing it in an Int[4][400] variable.

In the other frame i can sometimes have another class, that needs to work with this array.

So i need a way to read the array from the "main" applet.

i've tryed with a function "getMyArray" in the main applet that return the array, and a call to

MyArray=main.getMyArray();

in the "secondary" applet, but this method works only if the secondary applet starts the main (that i can't accept).

How can i obtain variables from another class?
Avatar of Mick Barry
Mick Barry
Flag of Australia image

You can access other applets using the AppletContext.

Applet other = applet.getAppletContext().getApplet(appletname);
SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fab1970
fab1970

ASKER

i'm really sorry...i can't remeber what was the right solution... so i will split the points, giving us the maximum amount possible.
:-)

http://www.evalu8.com.au
"Giving everyone a voice"