Can see in appletviewer but not in browser
Hy,
I am trying to display a text on JTextArea using the code below. In appletviewer this is OK but I can not see the text on browser (IE 6, NS 8, Firefox 1.0.7). The browser only show a retangle applet. No exceptions.
If I insert this two lines
output = " \nHy";
outputArea.append( output );
then I can see "Hy" but not the text in mytext.txt. Why?
Thanks
Flow
import java.io.*;
import java.awt.Container;
import javax.swing.*;
publicclass myClassextends JApplet{
publicvoid init(){
JTextArea outputArea =new JTextArea();
outputArea.setLineWrap(true);
outputArea.setWrapStyleWord(true);
outputArea.setEditable (false);
Container container = getContentPane();
container.add(new JScrollPane( outputArea ) );
String output ="";
String file ="mytext.txt";
try{
BufferedReader bufR =new BufferedReader(new FileReader(file));
String s =null;
while ((s = bufR.readLine()) !=null){
output += s;
}
bufR.close();
}catch (Exception e){
e.printStackTrace();
}
outputArea.setText(output);
}
}
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<applet code="myClass.class" width="300" height="80"></applet>
</body>
</html>

