Y
yawnmoth
I'm trying to, via an applet, download the contents of a URL and
display them. To that end - I've written test.java (which follows).
Unfortunately, it doesn't work. After showing the "splash screen" for
a while, it doesn't output anything. Any ideas as to why?:
import java.applet.*;
import java.awt.*;
import java.net.*;
import java.io.*;
public class test extends Applet
{
public void start()
{
try
{
URL url = new URL("http://www.google.com/");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.connect();
BufferedReader text = new BufferedReader(new
InputStreamReader(conn.getInputStream()));
String output = "";
while ( text.ready() )
{
output+= text.readLine();
}
add(new Label(output));
}
catch (Exception e)
{
}
}
}
display them. To that end - I've written test.java (which follows).
Unfortunately, it doesn't work. After showing the "splash screen" for
a while, it doesn't output anything. Any ideas as to why?:
import java.applet.*;
import java.awt.*;
import java.net.*;
import java.io.*;
public class test extends Applet
{
public void start()
{
try
{
URL url = new URL("http://www.google.com/");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.connect();
BufferedReader text = new BufferedReader(new
InputStreamReader(conn.getInputStream()));
String output = "";
while ( text.ready() )
{
output+= text.readLine();
}
add(new Label(output));
}
catch (Exception e)
{
}
}
}