We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › No class named 'Color'
Page Index Toggle Pages: 1
No class named 'Color'? (Read 1068 times)
No class named 'Color'?
Mar 16th, 2010, 3:31pm
 
I've always used this code to create a black background when presenting:

 frame.setBackground(new Color(0, 0, 0));

When I use it now I get an error message: 'Cannot find a class or type named "Color". Can anyone tell me what's up? I'm using Processing 1.1 on an Apple quad-core running 10.5.8.
Re: No class named 'Color'?
Reply #1 - Mar 16th, 2010, 3:43pm
 
color not Color
Re: No class named 'Color'?
Reply #2 - Mar 16th, 2010, 9:45pm
 
Also, since color() is a function call, the keyword 'new' is not needed.
Re: No class named 'Color'?
Reply #3 - Mar 17th, 2010, 12:09am
 
new Color() is Java (AWT).
I think Processing 1.1 removed default import of AWT classes (they were included by default in previous versions).
So you can change your call to:
frame.setBackground(new java.awt.Color(0, 0, 0));
(or import java.awt.Color if you use it several times), or just:
frame.setBackground(java.awt.Color.BLACK);
Re: No class named 'Color'?
Reply #4 - Mar 17th, 2010, 1:58am
 
Thanks, PhiLho - that works.
Page Index Toggle Pages: 1