当前位置: 代码迷 >> Java相关 >> 为何报这样的错.错在哪里呢?
  详细解决方案

为何报这样的错.错在哪里呢?

热度:106   发布时间:2007-06-06 17:38:59.0
为何报这样的错.错在哪里呢?
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;
}
}
搜索更多相关的解决方案: import  public  

----------------解决方案--------------------------------------------------------
没有引入java.awt.*
----------------解决方案--------------------------------------------------------
真是大意啊!!~~~~~谢谢啊.
----------------解决方案--------------------------------------------------------
  相关解决方案