954,506 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Java newb w/ code problem

Hi everyone !

This is my first new post, I have a problem with my Java code. I am trying to make a first applet, and have gotten this code from a book, "Java - An Introduction To Problem Solving & Programming", by Walter Savitch and Frank Carrano :

import javax.swing.JApplet;
import java.awt.Graphics;
public class HappyFace extends JApplet
{
      public void paint(Graphics canvas)
      {
            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);
       }
}


Any ideas why I keep getting an error message coming from NetBeans 5.5.1 that it can't find "HappyFacemain.class" ? Thanks in advance !

-dtfan6

dtfan6
Newbie Poster
10 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

You named your class HappyFace, not HappyFacemain.

jasimp
Senior Poster
3,623 posts since Aug 2007
Reputation Points: 533
Solved Threads: 53
 

I have tried renaming the file, but it doesn't seem to help. Can it be done that way, or does it have to be named that before compiling? Thanks for responding, btw, jasimp. :)


....Scratch that last post, I think I see what you mean, jasimp. I'll try that.

dtfan6
Newbie Poster
10 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

I have tried renaming the file, but it doesn't seem to help. Can it be done that way, or does it have to be named that before compiling? Thanks for responding, btw, jasimp. :)

Scratch the last thing I wrote above ^^^I think I see what you mean, jasimp. I'll try that.

dtfan6
Newbie Poster
10 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You