I'm a java beginner and I wanna know how to use applets. I've got this little test-program for the paint-applet :
import java.awt.*;
import java.applet.*;
public class Main extends Applet {
public void init() {
}
public void paint(Graphics g) {
setBackground(Color.blue);
g.setColor(Color.yellow);
g.drawRect(20, 20, 100, 50);
g.fillRect(20, 80, 100, 50);
}
}
But in the IDE, "Applet" in the 3rd line has a stripe through it.
And if I try to run the code, I get this error:
Error: Could not find or load main class sun.applet.AppletViewer
Caused by: java.lang.ClassNotFoundException: sun.applet.AppletViewer
I'm using IntelliJ as IDE and use jdk14
Can someone help?
question from:
https://stackoverflow.com/questions/65904377/how-to-use-applets-in-intellij 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…