diff --git a/java/examples/Topics/Advanced Data/HashMapClass/HashMapClass.pde b/java/examples/Topics/Advanced Data/HashMapClass/HashMapClass.pde index c320455d6..966641e24 100644 --- a/java/examples/Topics/Advanced Data/HashMapClass/HashMapClass.pde +++ b/java/examples/Topics/Advanced Data/HashMapClass/HashMapClass.pde @@ -13,6 +13,9 @@ * offer a simpler way of pairing Strings with numbers or other Strings. * Here we use a HashMap because we want to pair a String with a custom * object, in this case a "Word" object that stores two numbers. + * + * In this example, words that appear in one book (Dracula) only are colored white + * while words the other (Frankenstein) are colored black. */ // The next line is needed if running in JavaScript Mode with Processing.js @@ -35,7 +38,7 @@ void setup() { } void draw() { - background(0); + background(126); // Show words for (Word w : words.values()) { diff --git a/java/examples/Topics/Advanced Data/HashMapClass/Word.pde b/java/examples/Topics/Advanced Data/HashMapClass/Word.pde old mode 100644 new mode 100755 index 9fcb743fe..ed4302c88 --- a/java/examples/Topics/Advanced Data/HashMapClass/Word.pde +++ b/java/examples/Topics/Advanced Data/HashMapClass/Word.pde @@ -43,7 +43,7 @@ class Word { // The more often it appears, the faster it falls void move() { - float speed = map(totalCount,5,25,0.1,3); + float speed = map(totalCount, 5, 25, 0.1, 0.4); speed = constrain(speed,0,10); position.y += speed; @@ -56,10 +56,10 @@ class Word { // Depending on which book it gets a color void display() { if (countDracula > 0) { - fill(121, 0, 31); + fill(255); } else if (countFranken > 0) { - fill(33, 72, 122); + fill(0); } // Its size is also tied to number of occurences float fs = map(totalCount,5,25,2,24); diff --git a/java/examples/Topics/Advanced Data/HashMapClass/data/Georgia.ttf b/java/examples/Topics/Advanced Data/HashMapClass/data/Georgia.ttf old mode 100644 new mode 100755 diff --git a/java/examples/Topics/Advanced Data/HashMapClass/data/dracula.txt b/java/examples/Topics/Advanced Data/HashMapClass/data/dracula.txt old mode 100644 new mode 100755 diff --git a/java/examples/Topics/Advanced Data/HashMapClass/data/frankenstein.txt b/java/examples/Topics/Advanced Data/HashMapClass/data/frankenstein.txt old mode 100644 new mode 100755