Well, JavaScript will have to be used to open the window and populate the HTML - this is something the applet simply has no access to.
Luckily, JavaScript can easily call any public methods your Java applet provides. Unfortunately, Java cannot return a String[][] to JavaScript, but it CAN return a String.
So what you can do is have your Java applet return a JSON serialization of your String[][] array. JavaScript can then convert that JSON to a JavaScript array using the JSON.parse function (available on most modern browsers, but there are also libaries available at json.org)
So here's an example of what I am talking about (that works with at least Java 5 and Chrome):
The Applet Code
import java.applet.*;
public class Test extends Applet {
String data[][];
public void init() {
data = new String[5][2];
data[0] = new String[] { "Peter", "Griffin"};
data[1] = new String[] { "Glen", "Quagmire"};
data[2] = new String[] { "Joe", "Something"};
data[3] = new String[] { "Cleveland", "Brown"};
data[4] = new String[] { "Buzz", "Killington"};
}
public String getData() {
return toJSON(data);
}
/* Quick and dirty, you may want to look
* online for a 'complete' converter
*
* This returns [["Peter", "Griffin"], ["Glen", "Quagmire"], ... etc
*/
protected String toJSON(String data[][]) {
int x, y;
String s = "[";
for (y = 0;y < data.length;y += 1) {
s += "[";
for (x = 0;x < data[y].length;x += 1) {
s += "\""+data[y][x].replaceAll("\"","\\\"")+"\"";
if (x < data[y].length-1) {
s += ", ";
}
}
s += "]";
if (y < data.length-1) {
s += ", ";
}
}
s += "]";
return s;
}
}
The JavaScript Code
<html>
<body>
<p><applet id="applet" code="Test"></applet></p>
<input id="button" type="button" value="Click me"/>
<script type="text/javascript">
(function () {
var button = document.getElementById("button"), applet = document.getElementById("applet");
button.onclick = function () {
var html = [], newWindow, data = JSON.parse(applet.getData()), j;
html.push("<table><tr><th>First Name</th><th>Last Name</th></tr>");
for (j = 0;j < data.length;j += 1) {
html.push("<tr><td>"+data[j][0]+"</td><td>"+data[j][1]+"</td></tr>");
}
html.push("</table>");
newWindow = window.open();
newWindow.document.firstChild.innerHTML = html.join("");
};
}());
</script>
Let me know if you need further clarification!