File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes compile error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "compile error" Watch "compile error" New topic
Author

compile error

Nancy Bradley
Ranch Hand

Joined: Feb 25, 2004
Posts: 32
Hello,
I have to write a program that display color shapes.
I just started and try to compile what I had and got an error message.
Cannot resolve symbol
method setcolor(java.awt.Color)
g.setcolor(Color.green);
Cannot resolve symbol
method setcolor(java.awt.Color)
g.setcolor(Color.cyan);
I do not know what is wrong as it does not display any error for the other colors and they are written the same.
Any help would be appreciate it.
Thanks
Nancy
Francis Siu
Ranch Hand

Joined: Jan 04, 2003
Posts: 867
hi Nancy Bradley
Which version of compiler you use?
If I have not forgot, previous compiler version is reqiured to change the color name to capital letter
But I forget which version

Please try it

[ April 25, 2004: Message edited by: siu chung man ]

Francis Siu
SCJP, MCDBA
Antoine Waugh
Ranch Hand

Joined: Jan 24, 2004
Posts: 66
heya,
one of your setColor methods had a lowercase 'c' rather than uppercase. the following compiles fine

[ April 25, 2004: Message edited by: Antoine Waugh ]

B.C.S.T, SCJP, Hero
Antoine Waugh
Ranch Hand

Joined: Jan 24, 2004
Posts: 66
siu, it really trips me out when i reply and another is immediately there.
dont think i just stole your post


-twans
Francis Siu
Ranch Hand

Joined: Jan 04, 2003
Posts: 867
hi Antoine Waugh
Ooooooooooo.....Great, solve the problem
Antoine Waugh
Ranch Hand

Joined: Jan 24, 2004
Posts: 66
siu, we'll call it a joint effort
*notes so self that siu has about 325098809 more posts than twans*
Nancy Bradley
Ranch Hand

Joined: Feb 25, 2004
Posts: 32
Thanks a lot.
Nancy
Nancy Bradley
Ranch Hand

Joined: Feb 25, 2004
Posts: 32
Hi I got five errors after adding another figure. Did I forget to include something else in the code?.
Cannot resolve symbol
BufferedImage
Cannot resolve symbol
constructor Rectangle
Cannot reolve symbol
variable g2D
Thanks for your help
Nancy

[ April 25, 2004: Message edited by: Marilyn de Queiroz ]
Antoine Waugh
Ranch Hand

Joined: Jan 24, 2004
Posts: 66
heya,
firstly you need to add:
import java.awt.image.BufferedImage;
the awt.*; is not enough, as it only reads in the next directory listings.. and because BufferedImage is in image >> BufferedImage simply awt.* is not sufficient.
secondly in your call:

you have a spelling mistake. the RBG is meant to be 'Red Green Blue', so RGB

your other issue is that your g2d variable was being called as g2D. Java is case sensitive.
hope this helps
-twans
[ April 25, 2004: Message edited by: Antoine Waugh ]
[ April 25, 2004: Message edited by: Antoine Waugh ]
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
Antoine,

I think it might be more profitable for Nancy to do her own typing of code and thus learn about the case sensitivity of Java by experience rather than copy and pasting working code that you write for her.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Antoine Waugh
Ranch Hand

Joined: Jan 24, 2004
Posts: 66
Marilyn,
sure. just trying to help
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Moving this to the Swing / JFC / AWT forum...


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: compile error
 
Similar Threads
Small applet text problem
Can you give sample code to draw rectangle etc., etc.,?
weird and unwanted duplicate component is being painted, moving a component(Simple animation)
Cannot find symbol compiler error
Java not installed right?