• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compile problems with drawing applet

 
Brian Walsh
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having a problem with this program below it seems to not resovle the "page.fillOval", here is the program. Mind you this is still a work in progress, thank you for your help....

Here is the compile errors:
C:\Documents and Settings\Administrator\Desktop\Schoolie\Spring 2002\CS161\Workbench\Guest.java:27: invalid method declaration; return type required
public Guest (String owner, int sex, double spot)
^
C:\Documents and Settings\Administrator\Desktop\Schoolie\Spring 2002\CS161\Workbench\Guest.java:12: class RanCirc is public, should be declared in a file named RanCirc.java
public class RanCirc extends Applet
^
C:\Documents and Settings\Administrator\Desktop\Schoolie\Spring 2002\CS161\Workbench\Guest.java:39: cannot resolve symbol
symbol : variable page
location: class RanCirc
page.setColor (Color.blue);
^
C:\Documents and Settings\Administrator\Desktop\Schoolie\Spring 2002\CS161\Workbench\Guest.java:40: cannot resolve symbol
symbol : variable page
location: class RanCirc
page.fillOval (placeX, placeY, width, width);
^
C:\Documents and Settings\Administrator\Desktop\Schoolie\Spring 2002\CS161\Workbench\Guest.java:46: cannot resolve symbol
symbol : variable page
location: class RanCirc
page.setColor (Color.pink);
^
C:\Documents and Settings\Administrator\Desktop\Schoolie\Spring 2002\CS161\Workbench\Guest.java:47: cannot resolve symbol
symbol : variable page
location: class RanCirc
page.fillOval (placeX, placeY, width, width);
^
6 errors
Tool completed with exit code 1

thanks again for your help...
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Brian,
1. You must declare a return type on all methods except constructors.
public Guest
should be:
public void Guest
2. You can only have one public class inside any *.java file and the class and file names must exactly match (case sensitive). If the file is not named RanCirc.java then you can't have a public class inside of it called RanCirc.
3. You need to define any variable used inside the class where it will be used. Your variable page is never defined anywhere ...
NOTE: Error messages in java are impressive because they tell you exactly what you need to fix in order to compile it cleanly. Learn to read and understand them.
Regards,
Manfred.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic