File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Applets and the fly likes Arrays in Applets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Arrays in Applets" Watch "Arrays in Applets" New topic

Arrays in Applets

Amanda Weber

Joined: Nov 20, 2002
Posts: 28
Is there any way to pass an array into an applet?
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
What do you mean exactly? Where would the array come from?

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Amanda Weber

Joined: Nov 20, 2002
Posts: 28
For Example I have a regular HTML page that I want to keep as HTML - it is a form I want to pass many valued into an applet from the form. Instead of doing many getParams, can I just create it as an array, and pass it in to an appet?
Rob Ross

Joined: Jan 07, 2002
Posts: 2205
You could try passing a single parameter as a delimeted string, say a list of strings seperated by semicolons, then use java.util.StringTokenizer to extract the individual strings from your list.

SCJP 1.4
Amanda Weber

Joined: Nov 20, 2002
Posts: 28
Yah, that is what I am doing now, I was just wondering if there was an easier way
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1873
hey Rob,
c after long , huh? i thought either my eyes r getting worse not to c u or u r becoming too fat to be seen
anyways, hope u 've some memories reflecting my name...
i don't exactly remember right now but somebody asked the same question on JSP forum i guess. he wanted to pass an array of String to the applet which he was getting in the JSP that had the applet embeded in it. i suggested the same thing to him as i don't know any simple/direct way of passing an array.
also if we can use JavaScript and Applet communication using JSObject then we can have JavaScript array passed to an applet method. can't we?
I agree. Here's the link:
subject: Arrays in Applets
It's not a secret anymore!