アプレットで、ボタンを押したらフレームを開くようにしたのですが
フレームを閉じようとしても閉じません。どこがいけないのでしょうか?
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;

public class Applet2 extends JApplet {
FlowLayout flowLayout1 = new FlowLayout();
Button button1 = new Button();
/**アプレットの構築*/
public Applet2() {
}
/**アプレットの初期化*/
public void init() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
/**コンポーネントの初期化*/
private void jbInit() throws Exception {
button1.setLabel("Click");
button1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
button1_actionPerformed(e);
}
});
this.setSize(new Dimension(400,300));
this.getContentPane().setLayout(flowLayout1);
this.getContentPane().add(button1, null);
}
void button1_actionPerformed(ActionEvent e) {
Frame f = new SimpleFrame();
Button b = new Button("Click!");
f.add(b);
f.show();
}
}
class SimpleFrame extends Frame{
public SimpleFrame(){
addWindowListener(new WindowClose());
setTitle("Test");
setSize(400,200);
setLayout(new FlowLayout());
}
}
class WindowClose extends WindowAdapter{
public void windowClosing(WindowEvent e){
System.exit(0);
}
}