java小程序(笑脸)

问题描述 投票:0回答:1

到目前为止,这是我的代码:导入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个错误

java applet
1个回答
0
投票

因为没有扩展名为Japplet的超类。就像import语句所说的一样,它必须是JApplet。您需要按如下所示进行类声明:public class HappyFace extends JApplet

© www.soinside.com 2019 - 2024. All rights reserved.