Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Compile problems with drawing applet

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic