Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2007

Tip: Looking for answers? Try searching our database.

upper and lower case static color names in Color

Thread view: 
ChrisC - 23 Aug 2007 01:26 GMT
Just out of curiosity, why are there duplicate colors, such as
Color.red and Color.RED in the java Color class?  Color.RED would be
the standard notation for a static final...

Chris
Knute Johnson - 23 Aug 2007 03:04 GMT
> Just out of curiosity, why are there duplicate colors, such as
> Color.red and Color.RED in the java Color class?  Color.RED would be
> the standard notation for a static final...
>
> Chris

The lower case names were in the original version of Java before they
standardized on upper case names for the static finals.  The upper case
names were added in version 1.4.  Use the upper case names for any new code.

Signature

Knute Johnson
email s/nospam/knute/

Roedy Green - 23 Aug 2007 03:30 GMT
>Just out of curiosity, why are there duplicate colors, such as
>Color.red and Color.RED in the java Color class?  Color.RED would be
>the standard notation for a static final...

It is historical.  Originally they were all lower case. Then someone
pointed out this violated the static final all upper case naming
convention, and Sun fixed it. They had to leave the lower case names
to avoid breaking existing code.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.