- #1
fletchersally
- 2
- 0
Completely new to this and having some trouble with the following code...
I'm trying to run this code in Crimson editor:
but keep getting this error:
---------- Capture Output ----------
> "C:\Program Files (x86)\Java\bin\java.exe" Snowman
java.lang.NoSuchMethodError: main
Exception in thread "main"
> Terminated with exit code 1.
and I have no idea why!
Any help is greatly appreciated!
Thanks in advance.
I'm trying to run this code in Crimson editor:
Code:
import java.awt.*;
import javax.swing.JApplet;
public class Snowman extends JApplet {
public void paint (Graphics g) {
final int MID = 150;
final int TOP = 50;
setBackground(Color.CYAN);
g.setColor(Color.BLUE);
g.fillRect(0, 175, 300, 50);
g.setColor(Color.YELLOW);
g.fillOval(-40, -40, 80, 80);
g.setColor(Color.WHITE);
g.fillOval(MID-20, TOP, 40, 40);
g.fillOval(MID-35, TOP+35, 70, 50);
g.fillOval(MID-50, TOP+80, 100, 60);
g.setColor(Color.BLACK);
g.fillOval(MID-10, TOP+10, 5, 5);
g.fillOval(MID+5, TOP+10, 5, 5);
g.drawArc(MID-10, TOP+20, 20, 10, 190, 160);
g.drawLine(MID-25, TOP+60, MID-50, TOP+40);
g.drawLine(MID+25, TOP+60, MID+55, TOP+60);
g.drawLine(MID-20, TOP+5, MID+20, TOP+5);
g.fillRect(MID-15, TOP-20, 30, 25);
}
}
but keep getting this error:
---------- Capture Output ----------
> "C:\Program Files (x86)\Java\bin\java.exe" Snowman
java.lang.NoSuchMethodError: main
Exception in thread "main"
> Terminated with exit code 1.
and I have no idea why!
Any help is greatly appreciated!
Thanks in advance.
Last edited by a moderator: