• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

"cannot find symbol"

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.




 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 100
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Jonathan Wallace
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Friends help you move. Good friends help you move bodies. This tiny ad will help:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic