到目前为止,这是我的代码:导入javax.swing.JApplet;导入java.awt.Graphics;公共类HappyFace扩展了Japplet{公共无效涂料(图形画布){super.paint(画布);canvas.drawOval(100,50,200,200);canvas.fillOval(155,100,10,20);canvas.fillOval(230,100,10,20);canvas.drawArc(150,160,100,50,180,180);}}
我收到以下错误:HappyFace.java:3:错误:找不到符号公共类HappyFace扩展了japplet^符号:类jappletHappyFace.java:7:错误:找不到符号super.paint(画布);^符号:变量超级位置:类HappyFace2个错误
因为没有扩展名为Japplet
的超类。就像import语句所说的一样,它必须是JApplet
。您需要按如下所示进行类声明:public class HappyFace extends JApplet