permaculture playing cards*
The moose likes Swing / AWT / SWT and the fly likes color help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "color help" Watch "color help" New topic
Author

color help

AjayG Shah
Greenhorn

Joined: Aug 28, 2012
Posts: 4
Folks,
Below is a code I have been writing on my own (well a modification from what online version read). The error has been highlighted.



The error message reads: "green cannot be resolved to a variable". I really have no clue what this means. If somebody can help me 1)understand what this message actually means for future reference and 2) how to resolve the issue, I will really appreciate it.
Thanks a lot!!!
jatan bhavsar
Ranch Hand

Joined: Jul 23, 2008
Posts: 296

Hi Ajay,

Try to do some googling its quiet easy question and also plese use the code tag here.Dont post code without any code tags.

Here , you have taken the color type as string so you need to put the green in quotes which will solve the problem.

Regards
Jatan

AjayG Shah
Greenhorn

Joined: Aug 28, 2012
Posts: 4
Jatan,
Thank you for your reply!
1) What is code tag?
2) When are quotes NOT required? :S

Thank you! I apologize for not aligning my message as per the rules. Just a newbie here!!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38087
    
  22
If you write green, the compiler thinks you want the variable of that name. If you write "green", that means a String with the contents green.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38087
    
  22
I have added code tags, but that highlighted the iffy indentation. Have a look at some suggestions about indentation here.
 
wood burning stoves
 
subject: color help
 
Similar Threads
How to import classes in a subpackage from another sub-package?
Sun Sample queston #1
overriding a method
problems in subpackage and imports
inheritance and polymorphism across packages