私はアプレットを作ります:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.*;
import Java.io.*;
public class a extends JApplet
{
public void init()
{
EventQueue.invokeLater(new Runnable()
{
public void run()
{
add (new MaxC());
}
});
}
}
class MaxC extends JPanel
{
public MaxC()
{
maxlink = new JTextField(40);
JButton download = new JButton("Pobierz");
JButton play = new JButton("Odtwórz online");
download.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent event)
{
try
{
URL url = new URL("http://www.google.com");
InputStream response = url.openStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(response));
for (String line; (line = reader.readLine()) != null;)
{
maxlink.setText("yes");
}
reader.close();
}
catch (Exception e) {maxlink.setText(""+e);}
}
});
add(maxlink);
add(download);
add(play);
}
public JTextField maxlink;
}
Firefox と AppletViewer で動作していますが、署名すると動作しません ( http://java.sun.com/developer/onlineTraining/Programming/JDCBook/signed.html ) アクセス許可と開始について尋ねられますが、読み込みが行われます停止。どこが間違い?