为何报这样的错.错在哪里呢?
import java.net.*;import javax.swing.*;
import java.awt.event.*;
public class WebMenu extends JApplet implements ActionListener
{
WebButton[] choices=new WebButton[3];
public void init()
{
choices[0]=new WebButton("Obsure Store","http://www.163.com");
choices[1]=new WebButton("Obsure Store","http://www.qq.com");
choices[2]=new WebButton("Obsure Store","http://www.baidu.com");
FlowLayout flo=new FlowLayout(); //这里报错.为什么?
getContentPane().setLayout(flo);
for(int i=0;i<choices.length;i++)
{
choices[i].addActionListener(this);
getContentPane().add(choices[i]);
}
}
public void actionPerformed(ActionEvent ev)
{
WebButton clicked=(WebButton)ev.getSource();
try {
URL load=new URL(clicked.address);
getAppletContext().showDocument(load);
}
catch (MalformedURLException ex) {
showStatus("Bad URL:"+clicked.address);
}
}
}
class WebButton extends JButton
{
String address;
WebButton(String iLabel,String iAddress)
{
super(iLabel);
address=iAddress;
}
}