Welcome to Dream.In.Code
Become a Java Expert!

Join 150,403 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 937 people online right now. Registration is fast and FREE... Join Now!




Simple Graphics Trial Problem...

 
Reply to this topicStart new topic

Simple Graphics Trial Problem..., need help!

eklok
14 Mar, 2008 - 09:13 PM
Post #1

New D.I.C Head
*

Joined: 14 Mar, 2008
Posts: 3

CODE
import java.awt.*;
import java.applet.*;
import javax.swing.*;

public class GraphicsFRT extends JApplet
{
    public void paint (Graphics g)
        {
            g.setColor(new Color(10,100,255));
            g.drawLine(10,10,50,50);
            g.setColor(Color.red);
            g.drawRect(90,90,150,250);
            g.setColor(Color.green);
            g.fillOval(90,90,150,250);
            
            g.setColor(Color.yellow);
            g.fillArc(150,150,150,150,45,270);
            
            int x[] = {20,50,20};
            int y[] = {20,20,50};
            
            Polygon pol = new Polygon(x,y,3);
            g.setColor(Color.blue);
            g.fillPolygon(pol);
        }
}


java.lang.NoSuchMethodError: main
Exception in thread "main"


i got this problem whenever i run this code
and nothing happens! please help me out!
User is offlineProfile CardPM
+Quote Post

fsloke
RE: Simple Graphics Trial Problem...
14 Mar, 2008 - 09:29 PM
Post #2

D.I.C Regular
***

Joined: 19 Dec, 2007
Posts: 258



Thanked: 4 times
My Contributions
You cannot compile this code.... bcs is JApplet not JFrame

Applet mostly compile using Notepad with internet Explore extension such as html...

I forgot the format already... After you create the file then you double click it then you will see the thing you want to see....
User is offlineProfile CardPM
+Quote Post

1lacca
RE: Simple Graphics Trial Problem...
15 Mar, 2008 - 01:47 AM
Post #3

code.rascal
Group Icon

Joined: 11 Aug, 2005
Posts: 3,822



Thanked: 12 times
My Contributions
QUOTE(fsloke @ 15 Mar, 2008 - 06:29 AM) *

You cannot compile this code.... bcs is JApplet not JFrame

Applet mostly compile using Notepad with internet Explore extension such as html...

I forgot the format already... After you create the file then you double click it then you will see the thing you want to see....


He can, and must compile it!
He just can not run it as a normal application.
There are two (four) options:
- deploying it, and looking at it in a browser
- converting it to an application, and running normally
(- some IDEs support running an applet as an application right away)
(- there is an alternative deployment method, it is possible to deploy an applet with webstart, and run it as a webstart application, but it won't work with all applets, but I think it would take too much work for you)
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 07:18PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month