Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot find symbol compiler error

 
Jonathan Squires
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey here is my code


and when I compile I get the following error:
ColorNameComponent.java:28: cannot find symbol
symbol : variable DARKGRAY
location: class java.awt.Color
g2.setColor(Color.DARKGRAY);
^
ColorNameComponent.java:30: cannot find symbol
symbol : variable LIGHTGRAY
location: class java.awt.Color
g2.setColor(Color.LIGHTGRAY);
^
2 errors


Any help would be greatly appreciated
 
Matthew Brown
Bartender
Posts: 4566
8
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check the documentation carefully. There is no Color.DARKGRAY field. But there is one very similar.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch

You must be careful; even the tiniest spelling errors, as Matthew B is alluding to, will put the compiler off its stroke.
 
Jonathan Squires
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah thanks guys really appreciate the help

And thanks for the welcome!
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You’re welcome ( )
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic