Hello everyone!
I'm doing a project about treemaps and I used treemap library and the example of words treemap explained by Ben Fry in Visualizing Data. I need to make some modifications, but i have a problem when I'm trying access a variable.
In the main tab I wrote:
import treemap.*;
Treemap map;
void setup( ) {
size(1150, 768);
smooth( );
strokeWeight(2f);
PFont font = createFont("verdana", 9);
textFont(font);
WordMap mapData = new WordMap( );
String[] lines = loadStrings("data_update.txt");
for (int i = 0; i < lines.length; i++) {
mapData.addWord(lines[i]);
}
mapData.finishAdd( );
map = new Treemap(mapData, 0, 0, width, height);
noLoop( );
if (lines.length>0 && lines.length<11) {
int c=234;
}}
void draw( ) {
background(255);
map.draw( );
}
And in WordItem tab I have:
public class WordItem extends SimpleMapItem {
String word;
WordItem(String word) {
this.word = word;
}
void draw( ) {
fill(c); rect(x, y, w, h);
fill(23,45,90);
textAlign(CENTER, CENTER);
text(word, x + w/2, y + h/2);
}
}
It's obvious that processing cannot find anything named "c". However I tried write public methods and classes ... but anything works fine
Any suggestions?
Thanks a lot!