谁能告诉我为什么我得到以下例外
Exception in thread "main" java.lang.IllegalArgumentException adding a window to a container :
java.awt.Container.checkNotAWindow(Unknown Source)
java.awt.Container.addImpl(Unknown Source)
java.awt.Container.add(Unknown Source)
javax.swing.JFrame.addImpl(Unknown Source)
java.awt.Container.add(Unknown Source)
clockframe.<init>(clockframe.java:14)
clockframe.main(clockframe.java:32)
我在clockpanel.java文件中的代码如下:我是初学者,所以我不知道如何解决这个问题......
import java.awt.*;
import javax.swing.*;
public class clockframe extends JFrame
{
public clockframe()
{
super("Clock");
setLookAndFeel();
setSize(225, 125);
FlowLayout flo = new FlowLayout();
setLayout(flo);
clockpanel time = new clockpanel();
add(time);
setVisible(true);
}
private void setLookAndFeel()
{
try
{
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
}
catch (Exception exc)
{
// ignore error
}
}
public static void main(String args[])
{
clockframe clock = new clockframe();
}
}