Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes Compile problems with drawing applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Compile problems with drawing applet " Watch "Compile problems with drawing applet " New topic
Author

Compile problems with drawing applet

Brian Walsh
Greenhorn

Joined: Feb 06, 2002
Posts: 17
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...


-Thanks in Advance
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Compile problems with drawing applet