Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark ""cannot find symbol" " Watch ""cannot find symbol" " New topic
Author

"cannot find symbol"

Jonathan Wallace
Greenhorn

Joined: Aug 18, 2010
Posts: 18
I'm following a tutorial, for which unfortunately I don't have the answers (long story).

This:

Generates the following error:

What am I doing wrong...? Full code below.




Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

Welcome to the Ranch!

The error means that class BallPanel does not have a method named setColor that takes a java.awt.Color as its argument.

You probably want to call that method on the ball, because class Ball does have that method:

instead of:

in line 128 of BallWorld.java.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
lokesh sree
Ranch Hand

Joined: Oct 27, 2009
Posts: 99

Hi,
The error seems to be pretty straight forward and obvious.
Inside your class BallWorld at line 128, i.e, inside the BallPanel class, there is a function call setColor(Color.red); However, there is no such method called setColor inside the BallPanel class. You can add that method.


Lokesh
( SCBCD 5, CCENT, SCJP 5 )
Jonathan Wallace
Greenhorn

Joined: Aug 18, 2010
Posts: 18
Jesper de Jong wrote:Welcome to the Ranch!
Thanks!

Ah yes, that makes sense. All right, now that I see it, it's actually pretty obvious. Thanks again.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: "cannot find symbol"
 
Similar Threads
Bouncing balls
Help needed with the Code
Some anomalies driving me nuts...
Calling an applet from another class of the same package
Problems with a program...