Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

general approach to implementing multiple color name dictionaries?

RichFNov 11 2010 — edited Nov 15 2010
My [url http://r0k.us/graphics/SIHwheel.html]interactive color wheel applet currently has a single class providing names and hex values for over 1500 colors. I am considering offering multiple of these "color name dictionaries" (CNDs) -- the current set, Munsell colors, Sherwin Williams colors, etc.. Each dictionary element consists of a hex string providing the color value, and a name string. There are at least 3 approaches which might be possible:

1) store each CND in its own plain text file with file names ending in common extension, such as ".cnd". At run time, hunt for .cnd files in current directory and build a GUI selection list dynamically. This would likely be my approach in other languages, and would save space in the jar file. (One byte per character instead of two.) But I do not even know if an applet can read files in its own .jar. If it can, they would be in the current directory, right?

2) store each CND in its own class. Is there a way to just drop classes into a project, and have the java parent automatically recognize what CND classes there are and adjust the GUI to support it/them?

3) store all CNDs in one class, as separate 2-d arrays. It could end up as a huge class (the current class, with just one dictionary, is 78k in size), but might be the simplest to implement.

Which path would you take? Is there a better way that I haven't thought of?
This post has been answered by Kayaman on Nov 15 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 13 2010
Added on Nov 11 2010
21 comments
405 views